Updating the firmware of a usbasp

  This post is mostly for my personal reference and my “regular” readers will probably not care. I want to program a 89s52 microcontroller. I could buy a specialty programmer, but I already have a usbasp. The issue is that the usbasp that I have came with the original firmware. There’s a newer version that supports 89s52 chips. To update it, I need another programmer. I could buy a second usbasp but I don’t want to wait for it to arrive from the usual chinese ebay sellers. (cost is not the issue since they cost $3.77 delivered) Instead, I’ll use my Arduino. So here is the sequence of steps:
  1. open arduino SDK and load the ArduinoISP sketch from file->examples
  2.  compile and upload
  3. The comment section of the ISP sketch describes which pin is which.
  4. you need to connect the J2 jumper. In my case, I don’t have header, so I just used a piece of wire.
  5.  I found that it wasn’t obvious which pin of the ribbon cable connects to what on the usbasp
    1. If you’re looking at the ribbon connector, the tab is up and the ribbon goes left. Going from away from you to nearer, the connections are Miso, sclk, reset, unconnected, Mosi. The pin beneath the far pin Miso, is gnd and the pin beneath the close pin is pwr.
  6. To test, I first read the existing code:
    1. avrdude -c avrisp -P com3 -p atmega8 -b 19200 -U flash:r:abc2.hex:i
  7. To write:
    1. avrdude -c avrisp -P com3 -p atmega8 -b 19200 -U flash:w:usbasp.atmega8.2011-05-28.hex
This is the output I got:
avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.09s avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed          To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “usbasp.atmega8.2011-05-28.hex”
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: writing flash (4700 bytes): Writing | ################################################## | 100% 8.32s avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file usbasp.atmega8.2011-05-28.hex:
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: input file usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data: Reading | ################################################## | 100% 5.78s avrdude: verifying …
avrdude: 4700 bytes of flash verified avrdude: safemode: Fuses OK avrdude done.  Thank you.  
Updating the firmware of a usbasp

Leave a Reply

Your email address will not be published. Required fields are marked *