October 16, 2019

Updating firmware in a USBasp dongle

I keep seeing this warming:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
So, to fix this, you need two (or more!) USBasp dongles, and at least one of them needs to work! Connect them with a 10 pin ribbon. Pin 1 to pin 1 and so forth, no monkey business. You probably received such a ribbon cable, even properly keyed, with your unit and have been wondering what to do with it. Be sure both units are set to 5 volts (or set the same at any event).

Now run avrdude to read out the old firmware (or try to) and you will see:

avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
The remedy here is to connect the "programming jumper". On my unit this is JP1 and has pins soldered on already, I just need to find and install a shorting jumper.

After this, we can indeed read out the flash. Note that I append the ":i" option to save the file as Intel hex.

avrdude -p m8 -c usbasp -U flash:r:flash.hex:i

Get the new firmware

Get it from here: Curiously the most recent version is dated 2011-05-28. This makes it surprising that AVRdude is complaining about an old version. Hold that thought for now.

Once I download the tarball and expand the file, I go to bin/firmware and find the file usbasp.atmega8.2011-05-28.hex. Once I have this, I try to verify it against my device:

avrdude -p m8 -c usbasp -U flash:v:usbasp.atmega8.2011-05-28.hex:i
Indeed this indicates that the verify fails. So let's flash the new firmware.

Flash the new firmware

avrdude -p m8 -c usbasp -U flash:w:usbasp.atmega8.2011-05-28.hex
This suceeds as follows:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9307 (probably m8)
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% 5.64s
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% 2.93s
avrdude: verifying ...
avrdude: 4700 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:D9, L:9F)
avrdude done.  Thank you.
Very nice. I did this to my unit "C1", now we should be able to unplug the two units, flip it around to plug in the unit just upgraded, and use it to upgrade the other unit. Be sure and install the "programming jumper" on the target unit. Indeed this works fine, seems somewhat faster, and there are no complaints about being unable to set the sck period.

I repeat this on my third unit, which takes only seconds and now 3 of my 4 units are upgraded (E1, E2, and C1). I still have my DOA unit C2 to investigate.

I install the programming jumper on C2 and cable it up. No dice. This unit is simply dead. I looked under the microscope for solder bridges or obvious flaws. It looks fine. For $3 it isn't worth my time to screw with, especially when I have 3 other working units!

How other people did this


Feedback? Questions? Drop me a line!

Tom's Light Info / tom@mmto.org