Go Down

Topic: Can't Update The Firmware On My USBasp Atmega8 Using Arduino (Read 12512 times) previous topic - next topic


Given the directory you were in when you ran that avrdude command you stomped on your pre-built image.
You will either need to set up the makefile to re-build the hex image or re-download the full package again to recover that pre-built hex image.

--- bill


Dec 04, 2015, 09:30 am Last Edit: Dec 04, 2015, 09:35 am by angelosanzeri
Didn't avrdude update it already? How can I do it?

Didn't this (http://i.imgur.com/H84lNKY.png) already say it has been made?


No. there was no update.
Note that there are only messages about reading in the output and it says it was written to the file specified.
In the other thread PeterVH suggested that you read the flash and store it in a file to preserve it in case the udpate fails so you could get back to where you were before trying to update to newer firmware.

The command you entered told avrdude to read the flash and store it in a file.
That is what this means:  -U flash:r:usbasp.atmega8.2011-05-28.hex:i

It tells avrdude to read from "flash" and store it in the file named "usbasp.atmega8.2011-05-28.hex" and store it as intel hex records.

So given where it looks like where you were when the command was run it appears to have overwritten  the pre-built image.
Look at the modification date on the file. It will be the time you ran the command and not back in 2011.

--- bill


Here what I get executing PeterVH command: http://i.imgur.com/FdxUJrp.png.

Sorry, but I still don't get what I should do, sorry again


Not sure what you have hooked up at this point or what all you have done.
You also have some sort of error on the lsusb command which may mean you have udev permission issues.
From the lsbusb output I'm guessing that you removed all the wires and plugged the USBaspdev device into a USB port but didn't do the firmware update.

The f/w revision shows 1.02 which I'm guessing is what you originally had in the device.
You need 1.03 or newer to get the support for setting the ISP clock in s/w.

--- bill


Yes, I unplugged everything and plugged the USBasp in my pc and get the previous message.

Now I don't know what I should do. How can I update the firmware?


To update the firmware, you hook up an ISP programmer to the USBasp device and run avrdude.
You have to tell avrdude to write the contents of a file to the flash.
The last thing that I saw you do was to tell avrdude to read the flash and store its contents in a file.
That worked, but because the filename you told avrdude to store the flash image into  was the same as the pre-built f/w image file name you stomped on the pre-built f/w image file. In order to recover that f/w image file you will either need to re-build it with the makefile or re-download the full USBasp package again.
See posts 29, 30 and 32.

As PeterVH suggested I would recommend that you do save a copy of the original firmware just in case there is an issue upgrading so you can revert back to the original code that was shipped with the device.

--- bill


i have never seen a case where the protection fuses on a commercial unit were left open.  reading has always produced nothing but garbage.  they would have to be very foolish or careless to overlook that.

I'm also interested in your discussion, and if that discussion you were doing once will be in another thread I'll follow it
thanks and along with some prompting from a few offline friends decided to follow your advice:


im sure bill as always will get you going again but meanwhile just in case suggest you order a couple more units.  if nothing else eliminate any cabling or baud rate issues and never hurts to have backup.


you will either need to re-build it with the makefile

re-download the full USBasp package again
From where?

I would recommend that you do save a copy of the original firmware

Sorry but I seriously have no idea how can I do all the things you mentioned and I don't even know how can I look for them on the Internet, trying to find the solution by myself.

Thanks for the help


You have ArduinoISP working, so you are almost there.

First untar the usbasp.2011-05-28.tar.gz again, so you have your atmega8.2011-05-28.hex file back

Then backup the fw in the usbasp (mind the file name and the 'r' command):
Code: [Select]
sudo avrdude -c arduino -p m8 -P /dev/ttyACM0 -b 19200 -U flash:r:usbasp-ori.hex:i
Keep file usbasp-ori.hex for future reference.
Then flash the new fw (mind the file name and the 'w' command):
Code: [Select]
sudo avrdude -c arduino -p m8 -P /dev/ttyACM0 -b 19200 -U flash:w:atmega8.2011-05-28.hex:i


Now disconnect the usbasp from the uno and plug in the usbasp in the usb port.
Verify whether you have the new fw:

Code: [Select]
sudo lsusb -v -d 16c0:05dc | grep bcdDevice

It should now say 1.04



Could you first make the backup and post the usbasp-ori.hex here?
We could inspect whether it contains valid data.
(If not you might consider not continuing the upgrade)


Dec 05, 2015, 03:35 pm Last Edit: Dec 05, 2015, 03:41 pm by angelosanzeri
Here's what I did: http://i.imgur.com/AXYon4j.png (spoiler: it didn't work)

Here's the backup you asked: https://www.sendspace.com/file/ibaun0


It did work. avrdude successfully did everything you asked it to do.
You successfully read/downloaded the flash to a file and then also successfully wrote/uploaded the flash with a file.
The file you uploaded is the very same file you downloaded from flash.
Why you keep wanting to do this is a mystery to me.
You got lucky that the USBasp device wasn't soft bricked and is still working in that in order to have worked and be right back where you started the fuses allowed reading of the part.

When playing at this level, details really matter.
Peter gave you lots of explicit details and instructions in post #39
Take some time to slow down and carefully read what people are saying in the posts and read the output from your avrdude commands.
I'd also suggest that you take some time to read of the man page for avrdude to understand what the command options mean.

It appears that Angel's part was not locked since it appears that he read the flash into a file and then flashed that same file back into the part.

I think this latest sequence shows a possible way a user can soft brick his device when trying to update their device by reading the flash and then re-flashing it. If the fuses were locked it would have soft bricked the device with a garbage f/w image. This may be happening to some of the people that say their devices are "bricked".
I'm starting to agree with you in that for some folks it may be better for them to not try to upgrade their devices and live with the avrdude USBasp warning.
That said, a potential issue for them is that if they don't have some non-standard build that does auto SCK rate selection, then they won't be able to burn virgin AVR chips without using a jumper.

--- bill


yes, that soft brick thing was brought up in the other thread.  i have also seen harder bricking when beginners change clock fuses by mistake.  also permanent bricking by plugging in backwards.

however one benefit to going through all this is it often serves as a learning experience.  both for the arduino end and also programming in general.  amazing how many never even find out that there is such a thing as avrdude.


Sorry bperrybap, you can tell me everything but not that I'm one who does not care about details, that's because I look at details that i said it didn't work

It should now say 1.04
Does it say so? No.

I plugged in the USBasp with my microcontroller according to a book I'm trying to study and when I wrote
Code: [Select]
sudo avrdude -c usbasp -p m168, avrdude gave me the same error about updating my USBasp

Go Up