Upload new program over I2C

Hi Everyone,

Quick question...is it possible to export a compiled Arduino Sketch and then upload this data via I2C to overwrite a device's current EEPROM code?

In a nutshell, I have a Ras Pi with a few Arduinos connected to it via I2C. It would be a great feature to be able to update the Arduinos without having to manually connect USB to each one. Having code in the Arduino to allow program 'updates' is also OK.

Any ideas would be greatly appreciated. Thanks in advance for your help.

Sam.

Arduino sketches do not reside in EEPROM, that is a specific memory area, only 1K byte (1024) in size on a Uno. Sketches are run out the flash memory area, which is 32K bytes.
I don't think I've seen any discussions of a bootloader that updates via I2C. Not saying it's not possible, I just don't recall anyone doing that.

Thanks for the reply CrossRoads. Is it possible to write to the flash memory area programmatically or not?

Thanks - Sam.

Programming over SPI would be a more suitable option at the cost of a few more GPOI pins (3 pins + 1 per connected Arduino) as the arduino supports programming over SPI out of the box.

Hi Riva,

Unfortunately that's going to be a struggle as the Arduinos are connected in a line over 4 core cable with no option to wire all back to the Pi. They're effectively daisy chained together which would make using SPI unviable as far as I understand it.

Thanks for your input though.

Sam.

You could do that with an appropriate bootloader. AFAIK there are none around that use I2C so you'd have to write your own.

From Graynomad's suggestion you could look at this site where the author has a modified bootloader to program an ARV from an I2C flash memory chip.
Modifying Optiboot to use TWI instead of UART might be quite simple but you will need to write an equivalent of AVRDude that works over TWI instead of serial/telnet for your RPi

Successfuly connected a custom-made Arduino board (Atmega328p) to a 32 kByte I2C EEPROM. See miniboot for futher info.