Go Down

Topic: Flash a Sketch from I2C EEprom (Read 1 time) previous topic - next topic

fabiovaz

Hi all,

I've been working on a project that uses a GSM module. I'm able to download/upload data using it. I was wandering if it would be possible to update the arduino program with one I downloaded from the internet to an I2C EEprom like 24lc256. As far as I can see, it would be necessary a Bootloader which can read an I2C Eeprom, check if there is a new program there and if so, read it from the eeprom instead of reading it from serial and write it to the flash.

Would it be possible ?

oric_dan

Good idea, I think. Maybe someone has already done it.

I'm no bootloader expert, but it certainly sounds possible to me, and also might work light
years better than what I have tried - ie, using XBees to try and load a new sketch into an
Arduino chip. Basically, the latter doesn't work worth poo, since the normal transfer program
[avrdude] and normal bootloaders do not throttle and/or repeat packets properly, so the
transfers lose sync.

The XBee scheme worked in the past with slow bootloader transfers [eg, adafruit describes
it], but not anymore with optiboot, etc.

Normally, the uploading process first initiates an Arduino hard reset that causes a branch to
the bootloader, so it can start accepting the new code. I think you would have to include a
section in "every" sketch you wrote that could accept data, and store it to the I2C eeprom.
Then, produce a software reset that would branch to the [hacked] bootloader and read from
the I2C eeprom into Flash. Then, branch to the start location.

You could have a variable in I2C eeprom that would hold the version number, and a flag to
indicate whether the Flash has been updated, so it wouldn't try to do this every time you
turned the chip on.

This could be made more reliable than trying to Flash the sketch directly [ie using the IDE
as normal], since you could have packets and repeat packets and CRCs on the data transfers
to I2C eeprom. You can also get 32KB and 128KB I2C eeproms.

Hmmm, cool. Do it, and send me the code - please! ;-)




fungus


...update the arduino program with one I downloaded from the internet to an I2C EEprom like 24lc256. As far as I can see, it would be necessary a Bootloader which can read an I2C Eeprom, check if there is a new program there and if so, read it from the eeprom instead of reading it from serial and write it to the flash.

Would it be possible ?


Yes, exactly as you describe.

The datasheet has information on self-programming. You might need to abandon the Arduino IDE to write the bootloader.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

fabiovaz

oric_dan,

The solution you describe is perfect !!!! The bootloader already have the routine to read bytes from Serial and write them to flash. The big change would be reading them from I2C.

Your idea of checking the version at the i2c memory and CRCs is perfect wonderful.

The problem is I don't have the necessary skills to change the boot loader to do this. Hope anyone can read this topic and maybe help me this one. We are even willing to pay anyone who can deliver this functionality keeping the bootloader small. Anyone interested please post the contact here.



BR,
Fabio.

Go Up