I have created an RGB LED light program a while ago and I lost the sketch, is there a way to read the ATMega328 on my Arduino and extract the code so I can upload it to another Arduino?
I am downloading AVR Studio from Amtel thinking it will detect the Arduino and allow me to get into the chip, any suggestions?
if you press the [compile-upload] button with the shift pressed you get information how a sketch get uploaded (commands etc). If you are able to extract the hexcode from one Arduino this verbose output might give some clues how to upload the hexfile. Check AVRDUDE: 1 Introduction
The [b]op [/b]field specifies what operation to perform:
r read the specified device memory and write to the specified file
w read the specified file and write it to the specified device memory
So one can read and write from a device ( I expect reading will produce a 32K image, even if the original sketch was less)
and
The [b]format [/b]field is optional and contains the format of the file to read or write. Possible values are:
...
r raw binary; little-endian byte order, in the case of the flash ROM data
...
So it must be possible to download a raw binary from one device and upload it to another one. You must also have the port right and other flags, so read it more carefully than I did. As Cr0sh said you wil not get the sourcecode but this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1241117308 is about disassembling the generated hexcode so you may get a faint echo of the original source
PLease let us know if you succeeded as this is a way to quick multiply a busload of Arduinos with the same sketch. Very interesting.
Rob
update
Avrdude can be found at ~\arduino-0021\hardware\tools\avr\doc\avrdude
The application still worked - could see that with the serial monitor! However my IDE now gets a failure on avrdude when I try to upload a new sketch. Think I need to restart my PC because restaring the IDE did not solve it. I'll be back
rebooting didn't help either. => will be a reinstall of the IDE.
The application still worked - could see that with the serial monitor! However my IDE now gets a failure on avrdude when I try to upload a new sketch. Think I need to restart my PC because restaring the IDE did not solve it. I'll be back
That's because you likely blew away your bootloader uploading the binary - so you'll need to find a bootloader binary for your board, and upload that again so you can upload sketches with the Arduino IDE (if I am understanding you correctly?)...
and somehow a file avrdude was made of 0 bytes (besides the avrdude.exe) , somewhere I screwed up I did some avrdude calls that failed. Maybe that created the new file. As the IDE calls avrdude without extension it tried to start the wrong file and failed. After removeing these zero bytes fiel the IDE worked again. Yes!
@Cr0sh, wrt the bootloader, think it is in the 32K file(?). as all seems to work again (pffffh)
Yeah I lost the original code, it got mixed up in my dir with a bunch of versions of the file... I mean it's not a huge loss because it's simple RGB LED code but I had the colors perfect for what I was doing...
Thanks Rob, I will try extracting and transfering to another Arduino and see how far I get... If I can get it on another Arduino that would be great.
Thanks everyone, I will post my results after the weekend.