OTA FW update using I2C EEPROM



  • Hi,

    I have boards with I2C EEPROM (32 or 64kB) instead of a SPI flash already supported via dualoptiboot. Been looking a bit but haven't found any discussion about such so far? Sorry if I have missed one.
    I have both nRF24 and RFM69 radios in use and going to mysensors from my earlier proprietary system.

    Anyway I already started implementing changes to dualoptiboot and mysensors OTA code. IF someone knows of existing work please do point me there so I can stop working on it. My idea is to make a simple EEPROM (24(L)Cxxx) driver that looks like the SPI flash driver to make the changes to mysensors minimal. Seems so far only a few lines are needed in addition to the new driver. Bootloader is a bit more work. Any comments about this approach (in case it starts working well and someone else likes to use it) ?


  • Hardware Contributor

    @kisse66
    cool.
    so far only spi flash memory are supported. so, no i2c existing work for the moment i think ;)



  • It seems to work now. Boot loader needs some more work, but MySensors part should be usable. If someone likes to have a look you can find it at http://github.com/kisse66/MySensors fork. By default it still uses SPI flash and works just like the original. To use I2C EEPROM uncomment (MyConfig.h) or define MY_OTA_USE_I2C_EEPROM in your sketch. You'll need also MY_OTA_FIRMWARE_FEATURE of course.
    My code uses Wire library for I2C (new driver) and defaults to address 0x50 (real I2C address 0xA0) that most EEPROMs use I think. EEPROM has to use 16-bit addresses, 24(L)C256 or 512 should work.
    Only tested with MYScontroller, pro mini 8MHz with nRF24 and 24LC512 EEPROM on AVR HW I2C.

    Do note that I'm still working on the bootloader part which you'll need to make this actually work. I have a "seems like working" hack, but it needs some more work. Approach is to use DualOptiboot code and add option there for alternate I2C. I'll publish it when it's getting a bit better.



  • Please correct the warnings at https://github.com/mysensors/MySensors/pull/834
    I really want to see support for eeprom in official mysensors.



  • kisse66: i have error while writing bootloader:
    avrdude: ERROR: address 0x8010 out of range at line 65 of ...optiboot_atmega328_e8.hex
    I compile it with Arduino-1.0.x
    Can you share a compiled file?



  • The bootloader at github is not verified yet, it's an updated version from pieces I used to test. That's why I haven't mentioned it yet here. Looks like linking adresses are wrong. Will fix but can't promise when. Might have time next week.

    If you need it now, try lowering the --section-start=.text=0x7c00 at Makefile line 618 to 0x7a00 (or down to 0x7800). The 7c00 only allow for 1kB bootloader. You also need to have fuses set for max boot block. Luckily they are so as default in many pro mini's at least.

    I'll see if I still have the binary I used. It's for 8MHz pro mini.

    I'm interested in hearing if it works on your case as well. I'll be doing some more testing also and update github accordingly.



  • I changed to 0x7a00
    FUSE: L:FF H:DA E:05 this is 1024 words bootloader.

    And beautifully everything works.
    With little attention, I do not know why MYSCOntroller has been sending firmware several times.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.