cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice/sample code for field software upgrade for IOT device based on STM32L4XX?

JReis.11
Associate

Building an IOT device connected to Internet via WiFi. How to reliably update the firmware?

(If this is the wrong community group, please advise)

Sample code or projects would be great. We are thinking:

  • STM32L4xx FLASH set to dual bank mode.
  • Both banks contain identical bootloaders on their respective starting addresses
  • The BFB2 bit determines the active bootloader/software.
  • During upgrade, active software download and program new software in the inactive bank.
  • After successful download/program of new software, active software sets a flag in specified location in the internal FLASH to indicate upgrade and reboots.
  • When the bootloader comes up, it checks for the upgrade flag. If the upgrade flag is set, the bootloader sets the FB_MODE flag and jumps to the bootloader in the other bank.
  • Bootloader then jumps to the newly downloaded software.
  • If everything works, software updates the BFB2 flag to make current bank active.
  • If a problem is detected, system reboots and reverts back to the original software.

Questions are.

1. Does this approach sound reasonable?

2. Any obvious drawback from this approach?

3. Anyone taken a similar approach?

0 REPLIES 0