How to read the current program from an Arduino?

I've dumped a memory from Duemillenova with ATMega328P with the following command:

avrdude -C avrdude.conf -v -v -v -v -p atmega328p -c stk500 -U flash:r:"c:/arduino.hex":r -P\\.\COM2 -b57600

Does the Backup AVR with avrdude thread answer your question? Basically you can read all memory from an AVR as long as the protection fuse isn't set.

This is the setup I use for ATtiny's and ATmega's.

On the board shown:

  • 11 = MOSI
  • 12 = MISO
  • 13 = SCLK

Refer to the datasheet of the controller which exact pin to use. There are quite a few websites on Internet writing about programming AVR's using an Arduino, eg.: http://hlt.media.mit.edu/?p=1229


As far as I can see form the Arduino bootloader source code, there's no way to 'dump' all memory from it. The bootloader does support a 'monitor' mode which allows you to dump one memory byte at a time. However, as per the source code comments "/* monitor functions will only be compiled when using ATmega128, due to bootblock size constraints */"

As such, I guess you're out of luck if you don't want to use ISP, change the bootloader or upload a sketch to do it.

Tags:

Arduino