cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Semaphores for SBSFU in STM32WB

MBuen.1
Senior

Hello guys,

I've implemented SBSFU along side with an USB standalone loader for my project using a STM32WB. My question is, should i implement hardware semaphores and shci_notification for CPU2 during flash erasing and writing operations on my USB external loader? I don't use BLE in this loader, but the user app will and the microcontroller CPU2 will have a running ble stack.

I'm not sure how the "reset" of CPU2 works, if my userapp call for "NVIC_SYSTEM_RESET()", will CPU2 reset aswell? After reset, will CPU2 only start when my application call appe_init() or will it start automatically? I'm considering that because if CPU2 reset when microcontroller get a software reset and only runs after the call of appe_init(), i wouldn't need any hardware semaphores in my external loader, since CPU2 would be halted, right?

So, should or shouldn't implement hardware semaphores and shci_notification in my USB loader?

1 ACCEPTED SOLUTION

Accepted Solutions
Jocelyn RICARD
ST Employee

Hello @MBuen.1​ 

I'm sorry for late answer. As I'm not WB specialist, I had to check with my colleague.

NVIC_SYSTEM_RESET() resets both cores but after reset only CM4 boots.

So, to update firmware or stack you should go through a reset first.

This is actually managed in the version 2.5.0 of the SBSFU together with the standalone loader.

The project located in STM32CubeExpansion_SBSFU_V2.5.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\2_Images\ is behaving as following:

  1. User application wishes to execute standalone loader. It writes a pattern in specific SRAM location and performs NVIC_SYSTEM_RESET()
  2. CM4 boots into SBSFU. SBSFU boots CM0+ but only to get access to FUS API and load the key into AES HW
  3. SBSFU then passes the execution into standalone loader but before that it performs SW reset of CM0+ which enters low power mode and doesn’t use any resources from that point onwards.
  4. Standalone loader such as BLE_OTA needs to boot CM0+ again but in case of your custom USB loader there is no need and so you don’t need to worry about Semaphores or initializing mailbox interface.
  5. Standalone loader writes the new application into DWL Slot, writes special value into SRAM to tell SBSFU, whether it should interpret the content of DWL slot as User application image or RF STACK/FUS and triggers System reset.
  6. SBSFU will perform the installation and jump again to the user application. In case of RF Stack install there will be multiple resets during the process but the complexity of RF STACK or FUS installation is hidden from the user inside SBSFU.

Best regards

Jocelyn

View solution in original post

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @MBuen.1​ 

I'm sorry for late answer. As I'm not WB specialist, I had to check with my colleague.

NVIC_SYSTEM_RESET() resets both cores but after reset only CM4 boots.

So, to update firmware or stack you should go through a reset first.

This is actually managed in the version 2.5.0 of the SBSFU together with the standalone loader.

The project located in STM32CubeExpansion_SBSFU_V2.5.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\2_Images\ is behaving as following:

  1. User application wishes to execute standalone loader. It writes a pattern in specific SRAM location and performs NVIC_SYSTEM_RESET()
  2. CM4 boots into SBSFU. SBSFU boots CM0+ but only to get access to FUS API and load the key into AES HW
  3. SBSFU then passes the execution into standalone loader but before that it performs SW reset of CM0+ which enters low power mode and doesn’t use any resources from that point onwards.
  4. Standalone loader such as BLE_OTA needs to boot CM0+ again but in case of your custom USB loader there is no need and so you don’t need to worry about Semaphores or initializing mailbox interface.
  5. Standalone loader writes the new application into DWL Slot, writes special value into SRAM to tell SBSFU, whether it should interpret the content of DWL slot as User application image or RF STACK/FUS and triggers System reset.
  6. SBSFU will perform the installation and jump again to the user application. In case of RF Stack install there will be multiple resets during the process but the complexity of RF STACK or FUS installation is hidden from the user inside SBSFU.

Best regards

Jocelyn

MBuen.1
Senior

It's all good mate!

I really appreaciate your effort for answering my question. It was of a huge help. Thank you!