cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB5MMG BLE and FUS OTA update with SBSFU example

XaviF
Associate II

Hello there,

We are working on a project that includes a STM32WB5MMG in a custom board and we would like to update via OTA our firmware application, as well as the BLE stack and FUS. Our project is based on the P-NUCLEO-WB55.Nucleo 2 Images. This project defines two regions (slots) in the flash, one used to store the firmware to run and the other as a storage area for the new firmware image sent via OTA. The question here would be if we update either the BLE stack or FUS if they also have a separate storage area beyond the SFSA address (the start address where the current stack and FUS are stored) or if a flash region between the end of slot 2 and the SFSA address must be reserved as temporary storage for the new stack/FUS image.

Thanks in advance

6 REPLIES 6
Alan PORTE
ST Employee

Hello @XaviF,

I think this illustration could help you to understand how OTA is managed with SBSFU (from User Manual UM2262):

SBSFU_OTA.jpg

As you can see, the new wireless stack (or FUS, it is the same) will erase your user application in Flash.
So, at the beginning, the new wireless stack (which is encrypted) is not located in the secured area, but below the SFSA address (I've added "SFSA" on the illustration). Then, the FUS will detect the new image and handle the installation (the FUS modify the SFSA value during the operation).

The full description of the scenario can be found in UM2262:
https://www.st.com/resource/en/user_manual/um2262-getting-started-with-the-xcubesbsfu-stm32cube-expansion-package-stmicroelectronics.pdf#page=97

Hope this helps.

Best Regards,
Alan Porte
ST MCU Support Team

XaviF
Associate II

Hi Alan, thank you for your response.

I have a couple questions here: will the BLE_loader always store the new BLE stack at the beginning of the user application area, thus deleting the entire user application, or can this be configured somehow? The thing is in our project we do not have an external flash to store a backup of the user app. If it is mandatory to delete the user app, would still be possible to download it again after downloading the new BLE stack (although being inefficient)?

 

The other question is that the process you described is for the update of the BLE stack. I assume the update of the FUS via OTA would follow a similar process and would also erase the user app, is that right?

 

Thanks

XaviF
Associate II

Hi Alan, any update on the questions of my last post? We would really need to know if BLE stack/FUS new images received by OTA could be stored temporarily in the download slot of our dual slot SBSFU project or an extra area of flash should be reserved.

Thanks

Alan PORTE
ST Employee

Dear @XaviF,

The illustration is indeed a bit misleading on this point.
But in UM2262, the paragraphe just before the illustration is quite clear (in the link shared in my previous message - page 97):
stack_FUS.png

Thus, the download area for the new wireless stack (or FUS) is not at the beginning of the active slot, but at the end, just before the SFSA.
The scenario shared in my previous message is describing an example available in the SBSFU package (which is indeed using an external flash).

But if your user application is small enough, and depending on the BLE stack used (size are different), then external memory is maybe not needed. 

externalFlash.png

So meaning that if the user app is small enough, then it is not erased by the new wireless stack (and the backup slot is not needed).
STM32WB5MMG is 1024kB of Flash, a portion is occupied by the FUS (48kB) and the SBSFU itself (about 85kB according to Build Analyzer with the BLE_ota). 
So, at the end, it gives you 891kB to fit the others slots (download / active / wireless stack).

 

« I assume the update of the FUS via OTA would follow a similar process and would also erase the user app, is that right? »

The FUS is updated in the same way as the wireless stack (but is much smaller, thus you should not have this issue).

 

Best Regards,
Alan Porte
ST MCU Support Team

XaviF
Associate II

Hi Alan, sorry to bother you again but I want to have it all clear.

So, our SBSFU project has an active slot, then a download slot and then some unmapped or free space before the SFSA, all in the internal flash. From your last answer, I understand that the stack would be downloaded in the download slot too, which is right after the active slot, just as if a new user app image would have been downloaded by OTA. Is that correct? Or else, the SBSFU would download the stack in the free space after the user app download slot and before the SFSA.

In any of the above mentioned scenarios, will the SBSFU automatically decide which location to use depending whether the received image is a user app one or a stack one (I assume images have information headers that identify them)?

Thank you for your assistance

 

XaviF
Associate II

Hi again,

Since my last message was not answered, we decided to try updating the BLE stack FW image using the ST BLE Sensor App, chosing the option Wireless instead of Application. However, the update was not succesful and reading the BLE stack version using ST Programmer the stack version was not updated.

On the other hand, using the mobile App with the option Application and sending the new image of our application firmware works just fine.