Quite awhile ago I wrote a program for my UNO and it is working well. The problem is that I cannot find the original program to load it into another Arduino, such as a Pro Mini. Is there any way to safely read and copy the loaded program from the UNO to a file in my PC? If I could just read the loaded sketch I could print the program and manually reenter it into my PC, but I absolutely can't risk destroying the program by experimenting. Any help and guidance will be greatly appreciated.
No.
The code in the UNO is compiled code not C++.
It is possible to read the compiled code off the UNO and program a pro mini with that code, since both boards use the same atmega328 and are nearly functionally equivalent. The pro mini would need to be set up to run at 16MHz for any timing to work properly.
David, thanks for the response, but I need details on exactly how to do this, or I will probably screw it up badly. I'm kind of a novice, so be gentle (LOL).
It has been over a year since I did any experimenting with reading the flash memory off an arduino, maybe someone with more experience can post instructions on the process. Get two boards with the atmega328 processor (UNO, Nano, Mini, Pro Mini, etc) and practice with those before attempting anything on the UNO with the important code on it.
You will need to burn the UNO bootloader to the target board before copying the code, so that the fuses are set correctly, particularly in terms of correct flash memory allocation for the bootloader.
Thanks again David. I will try experimenting. The whole bootloader thing is foreign to be, but I imagine with a little google searching I can figure it out.
________________________________________________________________________________________________________
username@pcname:~$ /home/username/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/username/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:r:/tmp/Blinkfast.ino.hex:i
________________________________________________________________________________________________________
//////////// -Uflash:r: = read from flash write to /tmp/Blinkfast.ino.hex //////////////////
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading flash memory:
Reading | ################################################## | 100% 4.37s
avrdude: writing output file "/tmp/Blinkfast.ino.hex"
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
****************************************************************************************************
****************************************************************************************************
________________________________________________________________________________________________________
username@pcname:~$ /home/username/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/username/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:/tmp/Blinkfast.ino.hex:i
________________________________________________________________________________________________________
//////////// -Uflash:w: = read from /tmp/Blinkfast.ino.hex write to flash //////////////////
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "/tmp/Blinkfast.ino.hex"
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 5.56s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against /tmp/Blinkfast.ino.hex:
avrdude: load data flash data from input file /tmp/Blinkfast.ino.hex:
avrdude: input file /tmp/Blinkfast.ino.hex contains 32768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 4.38s
avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
Fantastic!!! Thanks so very much for your time and effort, greatly appreciated. I will try it out later tonight.