OTA without EEPROM
-
I've been involved in a project recently that needed to write to FLASH memory at runtime. This made me think about OTA updates of MySensor nodes. As I understand it, MySensors uses an external EEPROM to store the update in then rewrites the FLASH from this EEPROM. I'm thinking, would it be possible to do this without the EEPROM?
This is what I'm thinking... Let's say your sketch takes up 55% of atmega328 FLASH (based on a recent sketch of mine). You can write an independent sketch that could handle comms, downloading and flashing that can sit at top of memory. Assuming it is small enough to fit in with your existing sketch and any replacement sketch you may upload. It would obviously have to be a little more intelligent than a dumb flash bootloader. For instance, it would need to know if a download has failed or is partial and be able to communicate this back to the controller and only reboot when the entire new sketch is flashed.
I think it would be a pain to write and be very limited in flexibility regarding the size of the sketches you can upload, but it would mean you could make nodes without having custom boards with EEPROM built-in or adding EEPROMs to your simple designs.
Am I crazy, or is this something that would be useful to some? I'd certainly find it useful.
-
@Stuart-Middleton I think MySensors already has got you covered https://github.com/mysensors/MySensorsBootloaderRF24
From https://www.mysensors.org/about/ota
MYSBootloader does not require external flash.
-
Awesome! That has saved me a lot of work
I knew I should have spent some time doing the research before emptying my ideas into the forum!
-
@Stuart-Middleton no worries
Could you share some information on the project you are working on?
-
The project where I had to write to flash?
This was a network connected temperature and humidity sensor for a store room which had a built-in OLED display but was also network connected and hosted a website for graphing data output and displaying historical and real-time data. I wrote to flash so I could update the web page and other data OTA which was too big to fit in RAM or EEPROM and I didn't want to store on the SD card in case it was removed for any reason. It wasn't MySensors connected, unfortunately