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

Remi QUINTIN
Technical Moderator
March 20, 2020

Once the new application is loaded on the device via OTA, a reset is done.

After reset the application core starts to execute from address 0x8000000. This is the area occupied by BLE_OTA application.

The first thing that the BLE-OTA application does is:

• To jump to the User app when no OTA request is set or a valid User app is present

• Or Implement a BLE service to download the new FW (User app or Encrypted wireless stack)

When a FW update via OTA is requested, a connection is started with the master device to download the code.

After download, the BLE_OTA application generates a reset and the OTA_BLE applicationl looks for a valid application to be present.

When a Wireless stack has been downloaded and needs to be updated, the BLE_OTA application send a command to the FUS to decrypt and install the new FW.

If the new RF stack is not correct, the former one is still valid as the new erroneous one did not overwrite the current one during the OTA download.

AValt.1
Associate II
March 20, 2020

Hi Remi,

First of all thanks for your clear explanation, i still have some doubts, i will try to be clear.

My problem is that when updating Wireless Stack, with an invalid file the ota firmware doesnt jump to the valid aplication or ota aplication again, i still need to do a manual software reset to recover from that situation.

In order to be able to recover automatically from any situation, i add in the BLE OTA example(stCube1.5) 2 Software resets( lines 306 and 354 of app_entry.c.), to have an application that could recover after a Wireless Stack Update automatically without any user manual reset or something...

My question now is:

I know that i read FUS version 0x0000000, because and error during update process of the Wireless Stack, when i update it with a valid .bin file, (the 2 resets that i add in the code could be a problem i guess), but as in the beggining of the code there is a function: SHCI_C2_FUS_GetState, which after 2 calls (check page 3 in  https://www.st.com/resource/en/application_note/dm00513965-st-firmware-upgrade-services-for-stm32wb-series-stmicroelectronics.pdf  ) should activate FUS and recover the properly Wireless Stack behaviour, why is code execution blocked in that function?.

Finally, the only way to recover was:

Send 2 FUS_GET_STATE comands, i dit it via cli commands, connecting the board 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 SHCI_C2_FUS_GetState() commands at the beginning of code execution, 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.

To conclude i finally add in lines 303 and 353 of file app_entry.c a while( condition) befor NVIC_Reset(), where condition checks SHCI_C2_FUS_GetState()!=0, and everything is ok now, could you answer my question please, thanks a lot.

Regards

Alvaro