Skip to main content
cyancali
Associate II
November 29, 2019
Solved

STM32WBxx FUS seems to be deleted

  • November 29, 2019
  • 22 replies
  • 5498 views

Hi,

I am currently working with the STM32WB Nucleo Boards. I wanted to flash a new FW on the Dongle. Therefore I enabled USB DFU Mode. I used the following command to write the new FW:

$ ./STM32_Programmer.sh -c port=usb1 -w ~/Tools/STM32CubeWB/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_Ota/SW4STM32/Production/Debug/Production.elf

Output:

Memory Programming ...
Opening and parsing file: Production.elf
 File : Production.elf
 Size : 20512 Bytes
 Address : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 4]
erasing sector 0000 @: 0x08000000 failed
erasing sector 0001 @: 0x08001000 failed
erasing sector 0002 @: 0x08002000 failed
erasing sector 0003 @: 0x08003000 failed
erasing sector 0004 @: 0x08004000 failed
Erasing memory corresponding to segment 1:
Not flash Memory : No erase done
Download in Progress:
[==================================================] 100% 
 
File download complete
Time elapsed during download operation: 00:00:00.069

After that I could no longer reach FUS. I wanted to check the version but it returned only 0s:

Reading 32-bit memory content
 Size : 4 Bytes
 Address: : 0x20030030
 
0x20030030 : 00000000

I tried to use -fwdelete but it only returned errors:

FUS state is FUS_ERROR
 
FUS status is FUS_NOT_RUNNING
Error: Could not start service since FUS is not in IDLE state

I can't do anything at all anymore with this device! What happened?

According to the help/docu this shouldn't lead to bricked device!?

Does anyone know a solution to that issue?

Until now i could not find any help.

Best Regards

Alex

This topic has been closed for replies.
Best answer by cyancali

Thank you for your help! I tried to install a RF Stack (BLE Stack) and it returned success, but the logs seem not so promising. It seems not to erase any pages and in the end it says success but also FUS error...

FUS state is FUS_IDLE
 
FUS status is FUS_NO_ERROR
 
Old Firmware delete ...
 
Deleting firmware ...
Firmware delete finished
 
FUS state is FUS_SERVICE_ONGOING
 
FUS status is FUS_IMAGE_NOT_FOUND
 
FUS state is FUS_IDLE
 
FUS status is FUS_NO_ERROR
Download firmware image at address 0x80cb000 ...
 
 
Memory Programming ...
Opening and parsing file: stm32wb5x_BLE_Stack_fw.bin
 File : stm32wb5x_BLE_Stack_fw.bin
 Size : 165144 Bytes
 Address : 0x080CB000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [203 243]
erasing sector 0203 @: 0x080cb000 failed
erasing sector 0204 @: 0x080cc000 failed
erasing sector 0205 @: 0x080cd000 failed
erasing sector 0206 @: 0x080ce000 failed
erasing sector 0207 @: 0x080cf000 failed
erasing sector 0208 @: 0x080d0000 failed
erasing sector 0209 @: 0x080d1000 failed
erasing sector 0210 @: 0x080d2000 failed
erasing sector 0211 @: 0x080d3000 failed
erasing sector 0212 @: 0x080d4000 failed
erasing sector 0213 @: 0x080d5000 failed
erasing sector 0214 @: 0x080d6000 failed
erasing sector 0215 @: 0x080d7000 failed
erasing sector 0216 @: 0x080d8000 failed
erasing sector 0217 @: 0x080d9000 failed
erasing sector 0218 @: 0x080da000 failed
erasing sector 0219 @: 0x080db000 failed
erasing sector 0220 @: 0x080dc000 failed
erasing sector 0221 @: 0x080dd000 failed
erasing sector 0222 @: 0x080de000 failed
erasing sector 0223 @: 0x080df000 failed
erasing sector 0224 @: 0x080e0000 failed
erasing sector 0225 @: 0x080e1000 failed
erasing sector 0226 @: 0x080e2000 failed
erasing sector 0227 @: 0x080e3000 failed
erasing sector 0228 @: 0x080e4000 failed
erasing sector 0229 @: 0x080e5000 failed
erasing sector 0230 @: 0x080e6000 failed
erasing sector 0231 @: 0x080e7000 failed
erasing sector 0232 @: 0x080e8000 failed
erasing sector 0233 @: 0x080e9000 failed
erasing sector 0234 @: 0x080ea000 failed
erasing sector 0235 @: 0x080eb000 failed
erasing sector 0236 @: 0x080ec000 failed
erasing sector 0237 @: 0x080ed000 failed
erasing sector 0238 @: 0x080ee000 failed
erasing sector 0239 @: 0x080ef000 failed
erasing sector 0240 @: 0x080f0000 failed
erasing sector 0241 @: 0x080f1000 failed
erasing sector 0242 @: 0x080f2000 failed
erasing sector 0243 @: 0x080f3000 failed
Download in Progress:
[==================================================] 100% 
 
File download complete
Time elapsed during download operation: 00:00:02.445
 
FUS state is FUS_IDLE
 
FUS status is FUS_NO_ERROR
 
Firmware Upgrade process started ...
 
Updating firmware ...
Waiting for firmware upgrade end
 
FUS state is WIRELESS_STACK_UPGRADE_ONGOING
 
FUS status is FUS_NO_ERROR
 
FUS state is WIRELESS_STACK_UPGRADE_ONGOING
 
FUS status is FUS_NO_ERROR
 
FUS state is WIRELESS_STACK_UPGRADE_ONGOING
US state is WIRELESS_STACK_UPGRADE_ONGOING
FUS status is FUS_NO_ERROR
FUS status is FUS_NO_ERROR
 
FUS state is FUS_ERROR
 
FUS status is FUS_NOT_RUNNING
Firmware Upgrade Success

I tried to connect to it via my phone like before, but it does not get detected. It seems like the FUS itself is somehow damaged?

22 replies

cyancali
cyancaliAuthor
Associate II
December 10, 2019

This worked up to today, now I was working with two Nucleo boards to try and setup a connection between them. Today, I tried again to update the stack via the bootloader. This returned an error. After the upgrade I did -ob displ:

First board:

 Security Configuration Option bytes:
 
 ESE : 0x1 (Security enabled) 
 SFSA : 0x0 (0x0) 
 FSD : 0x0 (System and Flash secure) 
 DDS : 0x1 (CPU2 debug access disabled) 
 C2OPT : 0x1 (SBRV will address Flash) 
 NBRSD : 0x0 (SRAM2b is secure) 
 SNBRSA : 0x0 (0x0) 
 BRSD : 0x0 (SRAM2a is secure) 
 SBRSA : 0x0 (0x0) 
 SBRV : 0x3FC00 (0x3FC00) 

The SFSA is at 0x00? and also both SRAMs are locked?

For the second

 Security Configuration Option bytes:
 
 ESE : 0x1 (Security enabled) 
 SFSA : 0xCB (0xCB) 
 FSD : 0x0 (System and Flash secure) 
 DDS : 0x1 (CPU2 debug access disabled) 
 C2OPT : 0x1 (SBRV will address Flash) 
 NBRSD : 0x0 (SRAM2b is secure) 
 SNBRSA : 0xF (0xF) 
 BRSD : 0x0 (SRAM2a is secure) 
 SBRSA : 0xA (0xA) 
 SBRV : 0x3D000 (0x3D000) 

It seems to lock fine, but I neither can start the bootloader anymore or do any update via SWD and only returns me errors and finish the operation with no success.

Is there any option to reset these boards?

cyancali
cyancaliAuthor
Associate II
December 10, 2019

On the second board it seems like I can still upload an application via SWD, but as soon as I start it it runs into the NMI_Handler

Remi QUINTIN
Technical Moderator
December 11, 2019

SFSA = 0 => This is always a surprising effect I don’t understand. So you used the USB in DFU mode just to upload the RF stack only => fwdelete and then fwupgrade? same RF stack at the same address?

For the second board, I notice that the SBRV pointer is still pointing on the FUS code while the SFSA is correctly located at the beginning of the RF stack.

So this situation (SFSA pointing to address not in line with SBRV ) may occur when a wireless stack has been installed but then CPU2 has been switched to executing FUS.

This typically happens when, after installing the new wireless stack, too many -fusgetstate commands are sent (actually sending two times -fusgetstate makes the wireless stack switch CPU2 execution to FUS).

If you are reading the Device Info Table @0x20030890 and it's valid and presents the correct FUS version V1.0.2, it means that FUS is running correctly and communication with FUS shall be correct.

Now we need to make sure that communication with FUS is correct:

Let's just have a -fusgetstate command status through USB DFU.

Could you check the option bytes to verify the nBOOT0 and nSWBOOT0 are correctly set to enable the DFU mode?

cyancali
cyancaliAuthor
Associate II
December 15, 2019

On the second board I could enable DFU and called -fusgetstate, but it seems to not start the FUS.

./STM32_Programmer.sh -c port=usb1 -fusgetstate -------------------------------------------------------------------
 STM32CubeProgrammer v2.2.0 
 -------------------------------------------------------------------
 
 
 
USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : DFU in FS Mode
SN : 207E3171554D
FW version : 0x011a
Device ID : 0x0495
Device name : STM32WBxx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M0+/M4
 
 
FUS state is FUS_ERROR
 
FUS status is FUS_NOT_RUNNING
getFUSstate command execution finished

Reading 0x20030030 returns only 0x00.

Regarding the SFSA at 0x00, can this be reseted? I did a -fwdelete and -fwupgrade via SWD.

Remi QUINTIN
Technical Moderator
December 16, 2019

​Could you call FWgetstate a second time and check the version again.

cyancali
cyancaliAuthor
Associate II
December 16, 2019

Just did it a second time. First -fusgetstate and then read memory:

Reading 32-bit memory content
 Size : 4 Bytes
 Address: : 0x20030030
 
0x20030030 : 00000000

The error FUS_ERROR / FUS_NOT_RUNNING persists.

AValt.1
Associate II
March 19, 2020

Hi, i have almost same problem, SBRV value in my case is 0X3D000, and SFSA is 0xcb, i get this situation by updating with st ble sensor App sending an invalid wireless stack file, such as a pdf or whatever... how could i protect it?

Regards

Alvaro

Remi QUINTIN
Technical Moderator
March 19, 2020

Please send a FWdelete command to the device to erase the erroneous RF stack.

From what I can see, the FW update is wrong but the SFSA has anyhow been kept to 0xcb while the SBRV (the location where the M0+ should start its code execution) remain to the start of the FUS code.

Then try to update the FUS using the last CubeWB FW package V1.5.0. It contains the last V1.10 FUS version. In the end you should see 0x01010000 at address 0x20030030 (via USB port) and the SFSA should become 0xF6.

Then upgrade the RF stack you want.

AValt.1
Associate II
March 19, 2020

Hi Remi,

it doesnt seem to be a solution for me, i need to be able to update via OTA wireless Stack, and if i send via OTA a pdf or other invalid file, i see 2 scenarios:

  1. Sending an Invalid file with St Ble sensor App to update Wireless Stak: SBRV value is 0x3D000, and SFSA is 0xcb, while SBRV should be 0x32c00 (which is the value that i have read with st Cube Programmer whem it works properly), after update and receiving confirmation the 2 leds (blue and green remain turned on nothing happens, i need a solution to recover from that without making the final user do a Software reset....Any help?
  2. If i try to add in the Ble_ota Fw from last package 1.5, 2 resets lines 339 and 294 of file app_entry.c, it recovers from sending an invalid file to update wireless stack automatically, without the need of making software resets, but in this scenario, when i try to update the Wireless stack with a correct file this happens:

When updating with correct BLE Wireless Stack, and after having received update confirmation, it stays blocked in function

SHCI_C2_FUS_GetState() (the proyect Ble_OTA app, file app_entry.c line 275 ) and doesnt return, in that situation, i have tried to reset the board (Software reset), but it doesnt work. When that happens i have to connect the board as follows:

  1. Jumper between CN7.5(VDD) and CN7.7(Boot0)
  2. Power ON via USB_USER and Jumper JP1(USB_MCU)

And then when i execute this command via cli --> STM32_Programmer_CLI.exe -c port=usb1 -r32 0x20030030 1 i get:

USB speed  : Full Speed (12MBit/s)

Manuf. ID  : STMicroelectronics

Product ID : DFU in FS Mode

SN     : 20803176554D

FW version : 0x011a

Device ID  : 0x0495

Device name : STM32WBxx

Flash size : 1 MBytes

Device type : MCU

Device CPU : Cortex-M0+/M4

0x20030030 : 00000000

  1. So i have to install the fus again, why is this due to?

Please i need a profesional solution for both scenarios, from my point of view, reprogramming the board, or making Software resets manually is not a solution.

Regards

AValt.1
Associate II
March 20, 2020

Hi Remi,

I solved it, the reason why we are reading FUS version 0x0000000 is beacuse its not active, to activate it you have to send 2 FUS_GET_STATE comands, i dit it via cli commands, conected in usb BOOT mode interface, and then check FUS version wich is correct, then after that everything is ok, i wonder why if BLE_OTA firmware sends that commands at the beginning, it doesnt recover after 2 resets... it stays blocked there.. is it due to different behave when connected in usb Boot Mode?, i did not found documentation about it.

Regards

Alvaro