Copying from one Arduino to another

Is there any way to upload the code from one Arduino and then download it into another (or back to the same processor if I download a different sketch and screw it up)?

I have a Prusa 3D printer that uses an Arduino Mega as the controller. Before downloading new firmware into the processor (which might not work), I'd like to copy off what's in there already. The reason I can't just download what's in there already again, is that there are configuration settings that I don't have and can't recreate.

Thanks,

You can use AVRDUDE to read the contents of the flash and eeprom to hex files on the computer if you have a AVR ISP programmer - I think Arduino ISP should be able to do this. You can then write the hex files back to the chip at a later date if you need to.

You can even do it through the serial I/F. There is an app out there called ArduinoVirus that provides an example of how to do it. I used that as the basis of a library that let's one ProMini fully program another identical one, using nothing but a serial cross-over cable. The same mechanics will also read the contents of an Arduino.

Regards,
Ray L.

IraSch:
I have a Prusa 3D printer that uses an Arduino Mega as the controller. Before downloading new firmware into the processor (which might not work), I'd like to copy off what's in there already.

Don't you already have a copy from when you uploaded the existing firmware?

...R

Robin2:
Don't you already have a copy from when you uploaded the existing firmware?

...R

That's the problem - I bought this printer used, and there is no mfg identification. There are lots of configurable settings such as microstep settings, thermister type, etc. I don't know all of them. So I want to eventually upgrade to new firmware but need to trial-and-error the settings. Until I get it right, I still want to be able to print, so I would re-download the original "copied off" firmware. The original firmware is open-source, so it's not like I'm trying to bypass copyright, etc. Just don't have the Arduino source.

I'll try looking for the app mentioned.

Thanks.

Just to be clear, if you download the existing hex code from the Mega you will NOT be able to study it to see what the settings are. Compiling from C/C++ to hex code is a one-way process.

However you should be able to re-install the downloaded code if the new version proves unsuitable.

I would be very suprised if you can't find a website with the source code for your existing code. Have you enquired on the RepRap Forum ?

...R