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. Hardware
  3. OTA flash types for MySensors

OTA flash types for MySensors

Scheduled Pinned Locked Moved Hardware
64 Posts 23 Posters 24.6k Views 20 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.
  • KoreshK Koresh

    @Samuel235 said in OTA flash types for MySensors:

    AT45DB041E

    Hello. This chip (AT45DB041E) has no erase 32kb command (0x52), status read command has a strange opcode too (D7h). So it is no trivial task to use this chip.
    I can suggest Micron M25P40 as widespread IC. But it requires one trick and I will try to describe it. This chip has no erase 32kb command (0x52) too. It means OTA code will not erase memory and update will be failed. We (me and Yury) bumped into this problem when we started intensive tests of my nodes before production (we use micron M25P40). Moreover, when I try to investigate inexpensive avaliable chips I find an interesting thing. Chips with 64kb erase option (0xD8 opcode) are more common than chips with 32kb erase option (which support 64kb erase option too). So it can be worth adapting mysensors for use of any flash chip which supports 64kb erase option. To adapt your sketches you should do only two things

    1. Add this code into your sketch after including mysensors.h
    #define SPIFLASH_BLOCKERASE_32K   0xD8
    

    So OTA library will call erase 64kb command instead of erase 32kb command. It is very easy.
    2) You should use Bootloader which calls erase 64kb command instead of 32kb command.
    Bad news. It is not an easy task and you should recompile dual optiboot and burn it. :anguished:
    Good news. I've recompliled dual optiboot and all my nodes will burn with it by default. :yum:

    My changes in bootloader are very simple but it sutable for my boards. We update it many many times and the process is absolutely bulletproof (especially after Tekka's update :+1: ).
    But how about a more universal solution? I think it is not too hard to modify dual optiboot to check flash first 10 bytes (OTA flag) after 32kb erase command call and try another command? I will try this idea later but may be someone will do it faster :smiley:

    S Offline
    S Offline
    Samuel235
    Hardware Contributor
    wrote on last edited by
    #44

    @Koresh - Thank you for explaining this to me. I think i understand this a little more clearly now. Like i said, i've never dealt with flash so its all a grey area for myself.

    I'm currently looking at recompiling MYSBootloader for use with an 8Mhz crystal instead of this work around. The whole reasoning behind me asking this question is simply because i wanted OTA updates on a battery powered node. Now, this means i need OTA updates on 3.3v, but my MYSBootloader nodes require 16Mhz crystal to work. So its either use 16Mhz on 3.3v (while it works, its not the correct solution) OR to get a bootloader working with an 8Mhz crystal setup. I chose the later, and therefor its either recompile MYSBootloader to work with 8Mhz OR to get a flash IC on the board to allow for Dual Optiboot.

    At the moment i'm toying with the idea of going the software issue route and attempting to recompile MYSBootloader for 8Mhz (just need to workout what to change for the recompiled version). Seems a little easier and cheaper than going the route of flash considering my location and not being able to get my hands on the recommended/mostly used flash IC.

    MySensors 2.1.1
    Controller - OpenHAB (Virtual Machine)
    Gateway - Arduino Mega MQTT Gateway W5100

    1 Reply Last reply
    0
    • KoreshK Koresh

      @Samuel235 said in OTA flash types for MySensors:

      AT45DB041E

      Hello. This chip (AT45DB041E) has no erase 32kb command (0x52), status read command has a strange opcode too (D7h). So it is no trivial task to use this chip.
      I can suggest Micron M25P40 as widespread IC. But it requires one trick and I will try to describe it. This chip has no erase 32kb command (0x52) too. It means OTA code will not erase memory and update will be failed. We (me and Yury) bumped into this problem when we started intensive tests of my nodes before production (we use micron M25P40). Moreover, when I try to investigate inexpensive avaliable chips I find an interesting thing. Chips with 64kb erase option (0xD8 opcode) are more common than chips with 32kb erase option (which support 64kb erase option too). So it can be worth adapting mysensors for use of any flash chip which supports 64kb erase option. To adapt your sketches you should do only two things

      1. Add this code into your sketch after including mysensors.h
      #define SPIFLASH_BLOCKERASE_32K   0xD8
      

      So OTA library will call erase 64kb command instead of erase 32kb command. It is very easy.
      2) You should use Bootloader which calls erase 64kb command instead of 32kb command.
      Bad news. It is not an easy task and you should recompile dual optiboot and burn it. :anguished:
      Good news. I've recompliled dual optiboot and all my nodes will burn with it by default. :yum:

      My changes in bootloader are very simple but it sutable for my boards. We update it many many times and the process is absolutely bulletproof (especially after Tekka's update :+1: ).
      But how about a more universal solution? I think it is not too hard to modify dual optiboot to check flash first 10 bytes (OTA flag) after 32kb erase command call and try another command? I will try this idea later but may be someone will do it faster :smiley:

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

      @Koresh what about Winbond W25X40CLSNIG - the same used by Moteino? It seems to me this could be a good match?

      https://www.winbond.com/resource-files/w25x40cl_e01.pdf

      @tbowmo Thomas, what do you think?

      KoreshK 1 Reply Last reply
      0
      • alexsh1A alexsh1

        @Koresh what about Winbond W25X40CLSNIG - the same used by Moteino? It seems to me this could be a good match?

        https://www.winbond.com/resource-files/w25x40cl_e01.pdf

        @tbowmo Thomas, what do you think?

        KoreshK Offline
        KoreshK Offline
        Koresh
        Contest Winner
        wrote on last edited by Koresh
        #46

        @alexsh1 It seems suitable at first sight :wink:

        alexsh1A 1 Reply Last reply
        0
        • KoreshK Koresh

          @alexsh1 It seems suitable at first sight :wink:

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

          @Koresh I have just tried it and it works nicely.

          Start...Init OK!
          DeviceID: EF30
          Flash content:
          FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.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.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.
          Erasing Flash chip ... DONE
          

          The only disadvantage to me is voltage given that nrf24l01+ can run down to 1.9V

          Features

          • 2.3V to 3.6V supply
          • 1mA active current,
          • <1μA Power-down

          Aliexpress: $0.25 a piece + postage ($2.50 to Europe)

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

            I found the following one which is now offered in a breakout board.

            http://www.ebay.es/itm/2Pcs-W25q32b-Module-De-Memoire-Haute-Capacite-Module-De-Memoire-Interface-Spi-W-/132248126492?hash=item1eca9a441c:g:EukAAOSw4GVYI2CY

            I read the datasheet and compared the characteristics and instruction set with the ones for W25X40CLSNIG. I also checked against the SPIFlash.h file in github.

            Datasheet: http://www.elinux.org/images/f/f5/Winbond-w25q32.pdf

            To me everything seems consistent and am planning to order one to check. Does anyone see something what might prevent it from working?

            I'll report on what I find - it will be in some weeks since the delivery time is long.

            Nca78N 1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #49

              What do you think would be the best solution to fit a flash chip on the easypcb board?

              Nca78N 1 Reply Last reply
              0
              • M manutremo

                I found the following one which is now offered in a breakout board.

                http://www.ebay.es/itm/2Pcs-W25q32b-Module-De-Memoire-Haute-Capacite-Module-De-Memoire-Interface-Spi-W-/132248126492?hash=item1eca9a441c:g:EukAAOSw4GVYI2CY

                I read the datasheet and compared the characteristics and instruction set with the ones for W25X40CLSNIG. I also checked against the SPIFlash.h file in github.

                Datasheet: http://www.elinux.org/images/f/f5/Winbond-w25q32.pdf

                To me everything seems consistent and am planning to order one to check. Does anyone see something what might prevent it from working?

                I'll report on what I find - it will be in some weeks since the delivery time is long.

                Nca78N Offline
                Nca78N Offline
                Nca78
                Hardware Contributor
                wrote on last edited by
                #50

                @manutremo you can save nearly 40% of your money on AliExpress for those:
                https://www.aliexpress.com/item/Memory-Module-W25Q32B-High-Capacity-SPI-Interface-Flash-Memory-32M/32767512974.html

                M 1 Reply Last reply
                0
                • Nca78N Nca78

                  @manutremo you can save nearly 40% of your money on AliExpress for those:
                  https://www.aliexpress.com/item/Memory-Module-W25Q32B-High-Capacity-SPI-Interface-Flash-Memory-32M/32767512974.html

                  M Offline
                  M Offline
                  manutremo
                  wrote on last edited by
                  #51

                  @Nca78 Thanks for the hint. I actually purchased from this seller who is chaper:

                  http://www.ebay.es/itm/Module-De-Memoire-Dinterface-1Pcs-Spi-W25q32b-Haute-Capacite-Ic-Nouveau-K-/162656857086?hash=item25df1aabfe:g:1Z8AAOSwSblZqs0q

                  While the ebay seller shipped for free, Aliexpress would charge me 1.24€ for shipping to my country so the total price would be 2.63, significantly more expensive.

                  Many thanks anyways!

                  J 1 Reply Last reply
                  1
                  • gohanG gohan

                    What do you think would be the best solution to fit a flash chip on the easypcb board?

                    Nca78N Offline
                    Nca78N Offline
                    Nca78
                    Hardware Contributor
                    wrote on last edited by
                    #52

                    @gohan said in OTA flash types for MySensors:

                    What do you think would be the best solution to fit a flash chip on the easypcb board?

                    The best solution IMHO is to use MYSBootloader so you don't need a flash chip ;)

                    gohanG 1 Reply Last reply
                    0
                    • Nca78N Nca78

                      @gohan said in OTA flash types for MySensors:

                      What do you think would be the best solution to fit a flash chip on the easypcb board?

                      The best solution IMHO is to use MYSBootloader so you don't need a flash chip ;)

                      gohanG Offline
                      gohanG Offline
                      gohan
                      Mod
                      wrote on last edited by
                      #53

                      @Nca78 I thought about that, but there are quite some limitations like no encryption and signing support

                      AnticimexA 1 Reply Last reply
                      0
                      • gohanG gohan

                        @Nca78 I thought about that, but there are quite some limitations like no encryption and signing support

                        AnticimexA Offline
                        AnticimexA Offline
                        Anticimex
                        Contest Winner
                        wrote on last edited by
                        #54

                        @gohan I do believe mysbooloader has signing support.

                        Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                        gohanG 1 Reply Last reply
                        0
                        • AnticimexA Anticimex

                          @gohan I do believe mysbooloader has signing support.

                          gohanG Offline
                          gohanG Offline
                          gohan
                          Mod
                          wrote on last edited by
                          #55

                          @Anticimex does it? How about encryption?

                          AnticimexA 1 Reply Last reply
                          0
                          • gohanG gohan

                            @Anticimex does it? How about encryption?

                            AnticimexA Offline
                            AnticimexA Offline
                            Anticimex
                            Contest Winner
                            wrote on last edited by
                            #56

                            @gohan not sure. Better ask the author of the bootloader for that. Ping @tekka

                            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

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

                              also note:
                              so far MysBootloader is available for nrf24 only.
                              And for rfm69 FOTA, it's dualoptiboot bootloader based (from Lowpowerlab) which needs a flash ic.
                              It has been answered by tekka in another thread, but I don't think there is an eta for rfm69 MysBootloader yet..as the todolist isn't short !

                              1 Reply Last reply
                              0
                              • M manutremo

                                @Nca78 Thanks for the hint. I actually purchased from this seller who is chaper:

                                http://www.ebay.es/itm/Module-De-Memoire-Dinterface-1Pcs-Spi-W25q32b-Haute-Capacite-Ic-Nouveau-K-/162656857086?hash=item25df1aabfe:g:1Z8AAOSwSblZqs0q

                                While the ebay seller shipped for free, Aliexpress would charge me 1.24€ for shipping to my country so the total price would be 2.63, significantly more expensive.

                                Many thanks anyways!

                                J Offline
                                J Offline
                                jkandasa
                                Plugin Developer
                                wrote on last edited by jkandasa
                                #58

                                @manutremo said in OTA flash types for MySensors:

                                @Nca78 Thanks for the hint. I actually purchased from this seller who is chaper:

                                @manutremo I am getting trouble with W25Q32B. Can you help me to get success? I am struggling to get jedec id for this chip.

                                UPDATE: I included the following lines on the sketch it works,

                                //Enable OTA feature
                                #define MY_OTA_FIRMWARE_FEATURE
                                #define MY_OTA_FLASH_JDECID 0x00
                                
                                M 1 Reply Last reply
                                0
                                • J jkandasa

                                  @manutremo said in OTA flash types for MySensors:

                                  @Nca78 Thanks for the hint. I actually purchased from this seller who is chaper:

                                  @manutremo I am getting trouble with W25Q32B. Can you help me to get success? I am struggling to get jedec id for this chip.

                                  UPDATE: I included the following lines on the sketch it works,

                                  //Enable OTA feature
                                  #define MY_OTA_FIRMWARE_FEATURE
                                  #define MY_OTA_FLASH_JDECID 0x00
                                  
                                  M Offline
                                  M Offline
                                  manutremo
                                  wrote on last edited by
                                  #59

                                  @jkandasa happy to see that you solved it. In case it matters, I didn't need to add the second line.

                                  1 Reply Last reply
                                  0
                                  • scalzS scalz

                                    @tbowmo I thought same things...
                                    @ahmedadelhosni : translation roughly done ;) Here http://forum.mysensors.org/topic/3503/sensebender-dualoptiboot-ota-howto-in-mysensors

                                    P Offline
                                    P Offline
                                    p359
                                    wrote on last edited by
                                    #60

                                    Hi, old thread but I hope a question not too far off the mark. I'm using Easy PCB nodes and looking to use OTA on the reverse side. I'm having some issues finding a source in Australia for the SPI chip mentioned, I am seeing this one very easily available. From the data sheet on the page, it appears to be pretty much the same, just the lower end of the acceptable voltage is up to 2.6V. Any thoughts welcome if you can see if it would/wouldn't work, my tech knowledge is limited on this sort of thing.

                                    https://au.rs-online.com/web/p/flash-memory/8228477

                                    Cheers!

                                    sundberg84S 1 Reply Last reply
                                    1
                                    • P p359

                                      Hi, old thread but I hope a question not too far off the mark. I'm using Easy PCB nodes and looking to use OTA on the reverse side. I'm having some issues finding a source in Australia for the SPI chip mentioned, I am seeing this one very easily available. From the data sheet on the page, it appears to be pretty much the same, just the lower end of the acceptable voltage is up to 2.6V. Any thoughts welcome if you can see if it would/wouldn't work, my tech knowledge is limited on this sort of thing.

                                      https://au.rs-online.com/web/p/flash-memory/8228477

                                      Cheers!

                                      sundberg84S Offline
                                      sundberg84S Offline
                                      sundberg84
                                      Hardware Contributor
                                      wrote on last edited by sundberg84
                                      #61

                                      @p359 - not really good at these external flash either... but as you said its a 2.8-3.6v chip meaning you limit the EasyPCB to a regulated 3.3v 8mhz Pro mini. Battery operations will be hard to achieve (not impossible though). But since you are aiming for OTA i guess you wont be using sleep/battery.

                                      for how to write to the chip, im not the person to ask/answer since this is quite new to me but it seems like a fair price so maybe worth a shot.

                                      Controller: Proxmox VM - Home Assistant
                                      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                                      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                                      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                                      P 1 Reply Last reply
                                      0
                                      • gohanG Offline
                                        gohanG Offline
                                        gohan
                                        Mod
                                        wrote on last edited by
                                        #62

                                        It is possible to use battery, just use smartsleep instead of sleep to allow a little extra time for the controller to send the OTA update command and you can also use LiFePO4 batteries that work exactly in that voltage range.

                                        1 Reply Last reply
                                        1
                                        • sundberg84S sundberg84

                                          @p359 - not really good at these external flash either... but as you said its a 2.8-3.6v chip meaning you limit the EasyPCB to a regulated 3.3v 8mhz Pro mini. Battery operations will be hard to achieve (not impossible though). But since you are aiming for OTA i guess you wont be using sleep/battery.

                                          for how to write to the chip, im not the person to ask/answer since this is quite new to me but it seems like a fair price so maybe worth a shot.

                                          P Offline
                                          P Offline
                                          p359
                                          wrote on last edited by
                                          #63

                                          @sundberg84 you raise an obvious point about upper voltage that I'd overlooked to to be honest. I'll make a 3.3v node up to test when the chips arrive to test. If it works, perhaps try to use on 5v node with a shifter. Will report back if they work or not. I see also in the code now, reference to using i2c eeproms. Plenty of options to try. Thanks

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


                                          16

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 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