Martin's corner on the web

FOTA update without external flash for Atmega32U4 + RFM69

I’ve blogged before why firmware-over-the-air (FOTA) updates are a must-have nowadays, however, my old AVR+RFM based projects were incapable of that due to the lack of external flash to temporary store the new firmware before it is flashed on the chip. The Moteino project does have FOTA capabilities and Felix has created an excellent library for this, sure by using external SPI flash chip. David Berkeley has done similar work with an I2C external chip.

I was contacted a couple of days ago by Vitezslav Vlcek, who managed to do FOTA for the Atmega32U4 + RFM69 based Funky v3 without the use of the external flash module. The catch is that you can use half of the available for custom applications 28K of internal flash. Quite a limitation, but an impressive achievement none the less. He modified the Caterina bootloader to expose a function that wraps the SPM instruction and makes a call from the application code to that function in order to re-flash.

Below is the available memory layout:

Start address Stop address Size Description
0x0000 0x37FF 14KB=14336B Application code (app area)
0x3800 0x3801 2B Length of data in temp area (Length >14334 means temp area contains invalid data)
0x3802 0x6FFF 14334B Temp area
0x7000 0x7FFF 4KB=4096 Bootloader area (bls)

Read all about it on Vitek’s Github page. Thanks to Vitek for documenting in such detail this!



Tagged on: , , ,