Programming an Arduino using another Arduino programmatically


I want to program an Arduino using another Arduino but without any PC connections. I will load the code that will be flashed to the second Arduino to the first Arduino, then it will flash this code to the second.

Is it possible?

As long as the size of the two codes doesn’t exceed the memory of the programming device, yes.

Otherwise, use an AD card.

There is a utility out there called “Arduino Virus” that does exactly that. I’ve used it and it works great. My version of it for the AVR328 is below. I haven’t used it in years, so you’ll have to figure out how to use it from the code.

Ray L.

FlashCopy.h (2.29 KB)

FlashCopy.cpp (6.02 KB)

Using the above FlashCopy appears to be quite simple:

// Create an instance of the FlashCopy object
//    SLAVE_RESET_PIN is the I/O pin used to reset the device to be FLASHed
//    LED_PIN is a pin with an LED attached, so FlashCopy can blink the LED to indicate it is working
//    SLAVE_FLASH_SIZE is the size of the FLASH image to program in the target device.  This is the
//    size of the "sketch" area, NOT including the space occupied by the boot loader.
//    Target device must have a working bootloader.  For a 328, this is 30Kbytes.
// Do the copy

Regards, Ray L.