Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. OTA FW update using I2C EEPROM

OTA FW update using I2C EEPROM

Scheduled Pinned Locked Moved Development
27 Posts 6 Posters 7.4k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • kisse66K Offline
    kisse66K Offline
    kisse66
    wrote on last edited by
    #1

    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) ?

    1 Reply Last reply
    3
    • scalzS Offline
      scalzS Offline
      scalz
      Hardware Contributor
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1
      • kisse66K Offline
        kisse66K Offline
        kisse66
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        5
        • M Offline
          M Offline
          melwinek
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • M Offline
            M Offline
            melwinek
            wrote on last edited by
            #5

            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?

            1 Reply Last reply
            0
            • kisse66K Offline
              kisse66K Offline
              kisse66
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                melwinek
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  melwinek
                  wrote on last edited by
                  #8

                  When eeprom ota will be attached to official development branch ?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    melwinek
                    wrote on last edited by
                    #9

                    kisse66: Can you refresh your sources? Official Mysensors has now added a very cool option: MY_SIGNING_SIMPLE_PASSWD.
                    What determines the moment to add your changes to the official distribution?

                    1 Reply Last reply
                    0
                    • kisse66K Offline
                      kisse66K Offline
                      kisse66
                      wrote on last edited by
                      #10

                      It's up to the maintainers to decide if it's good enough implementation and then when to merge the PR. There has been no comments yet.

                      I don't like to update my version now as it's pending.

                      alexsh1A 1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        melwinek
                        wrote on last edited by
                        #11

                        I wish it was so long. You did a great job.

                        1 Reply Last reply
                        0
                        • kisse66K kisse66

                          It's up to the maintainers to decide if it's good enough implementation and then when to merge the PR. There has been no comments yet.

                          I don't like to update my version now as it's pending.

                          alexsh1A Offline
                          alexsh1A Offline
                          alexsh1
                          wrote on last edited by
                          #12

                          @kisse66 Excellent work - I have a few nodes with i2c eeprom waiting for MySensors to support it.

                          1 Reply Last reply
                          0
                          • Nca78N Offline
                            Nca78N Offline
                            Nca78
                            Hardware Contributor
                            wrote on last edited by
                            #13

                            Wow, great job, thank you @kisse66 !
                            Any limit in the size of the memory chips ? Like is it a problem if I use a 256/512k version ?

                            kisse66K 1 Reply Last reply
                            0
                            • Nca78N Nca78

                              Wow, great job, thank you @kisse66 !
                              Any limit in the size of the memory chips ? Like is it a problem if I use a 256/512k version ?

                              kisse66K Offline
                              kisse66K Offline
                              kisse66
                              wrote on last edited by
                              #14

                              @Nca78
                              Good question - Have only tested 256 and 512kbit (32/64kB), nothing bigger than 64kB. Unfortunately I2C protocol is slightly different between different EEPROMs, so code does have limitations. There's two sides of it. MySensors side now uses extEEPROM underneath, so what it supports should work. Address type is 32-bit, so the interface supports >64kB. Haven't checked the code, but at least it defines 2Mbit type (see extEEPROM.h). My patch now assumes EEPROM is 32kB (64 fine) as it's enough for mega328.

                              Bigger issue is the bootloader, which has more assumptions. Likely not working as is for anything bigger than 64kB. Would be interesting to hear if someone can try, I don't have larger EEPROMs.

                              1 Reply Last reply
                              1
                              • M Offline
                                M Offline
                                melwinek
                                wrote on last edited by
                                #15

                                kisse66: Arduino with this bootloader without connected EEPROM hang in bootloader with DEBUG: SSF2

                                kisse66K 1 Reply Last reply
                                0
                                • M melwinek

                                  kisse66: Arduino with this bootloader without connected EEPROM hang in bootloader with DEBUG: SSF2

                                  kisse66K Offline
                                  kisse66K Offline
                                  kisse66
                                  wrote on last edited by
                                  #16

                                  @melwinek
                                  hmm, interesting. There should be a timeout, but I need to re-check. Are the I2C pins floating or are the pullup resistors still there?

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    melwinek
                                    wrote on last edited by
                                    #17

                                    kisse66: Bootloader hang only when i disconnect pullup.

                                    1. Pullup and EEPROM - OK
                                    2. Pullup without EEPROM - OK
                                    3. Only EEPROM - Hang
                                    4. Free I2C pins - Hang
                                    kisse66K 1 Reply Last reply
                                    0
                                    • M melwinek

                                      kisse66: Bootloader hang only when i disconnect pullup.

                                      1. Pullup and EEPROM - OK
                                      2. Pullup without EEPROM - OK
                                      3. Only EEPROM - Hang
                                      4. Free I2C pins - Hang
                                      kisse66K Offline
                                      kisse66K Offline
                                      kisse66
                                      wrote on last edited by
                                      #18

                                      @melwinek
                                      Thanks, good info. Middle of vacation activities here but I looked the code a bit more. It does have the retry limit, but also forever loops with certain I2C events. Can be fixed quite easily I believe. I need to setup test bed for it to see myself.

                                      Not an urgent thing I believe?

                                      M 1 Reply Last reply
                                      0
                                      • kisse66K kisse66

                                        @melwinek
                                        Thanks, good info. Middle of vacation activities here but I looked the code a bit more. It does have the retry limit, but also forever loops with certain I2C events. Can be fixed quite easily I believe. I need to setup test bed for it to see myself.

                                        Not an urgent thing I believe?

                                        M Offline
                                        M Offline
                                        melwinek
                                        wrote on last edited by
                                        #19

                                        @kisse66
                                        This is not urgent.
                                        Nice holiday :)

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          manutremo
                                          wrote on last edited by
                                          #20

                                          Hi, I just wanted to report that I was able to compile and use the dualoptiboot bootloader with I2C support on a Mini Pro 8MHz board with an I2C AT24C256 breakout board and a RFM69HW radio. With this setup I've been able to to update several sketches via OTA using MysController.

                                          I took me some time to understand the workflow and necessary tools since I wasn't able to find a complete, up to date tutorial. Specifically, it took me some time to find out that the compilation of the bootloader with the Arduino IDE requires downgrading to version 1.0.6.

                                          I also run into some issues with the Arduino IDE not being able to find the extEEPROM.h file (even though it was indeed present at the correct location), and having to copy the i2c.h file to the optiboot folder in addition to the optiboot.c and the Makefile files.

                                          Also, I finally managed to flash it using avrdudess since I was getting errors when trying to use the IDE.

                                          So even though the author above that this bootloader isn't yet finished, it's working properly. Granted that I haven't tested it thoroughly under all scenarios, but it certainly looks promising. Can't wait to see it fully implemented in the mysensors framework. I'll continue reporting any additional findings.

                                          Many thanks!

                                          kisse66K 1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          18

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular