cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55CEUx custom board ble stack updating.

HKIM.13
Associate II

Hi, I recently designed my own pcb board for STM32WB55CEUx MCU.

Then, during working with my board I got some problem at APP_BLE_Init() function

and the symptoms are exactly same with

this

STM32WB55 BLE Stack trouble on new hardware: https://community.st.com/s/question/0D50X0000B5IOp2SQG/stm32wb55-ble-stack-trouble-on-new-hardware

and this

STM32WB : Bug in FW_WB_V1.0.0: aci_gap_set_discoverable > hci_send_req > hci_cmd_resp_wait - wait infinitely for hci_cmd_resp_release after few connection/disconnection

https://community.st.com/s/question/0D50X0000AYqZ6mSQF/stm32wb-bug-in-fwwbv100-acigapsetdiscoverable-hcisendreq-hcicmdrespwait-wait-infinitely-for-hcicmdresprelease-after-few-connectiondisconnection

So, I think I should update the ble stack inside my mcu.

But, I can only find the examples for the nucleoboard, which has USB bootloader mode.

I only have ST-link interface in my custom board.

How can I update ble stack with only stlink? or is it impossible?

Every pins of STM32WB55CEUx is available in my custom pcb board and other normal functions except ble work normally.

Any other tips for my situation is welcomed.

32 REPLIES 32
Remi QUINTIN
ST Employee

OK the issue is coming from the fact that the FUS_operator (the FW converting commands from the SWD port into commands to be processed by the FUS) is not able to be loaded at 0x08000000. As a consequence, none of the FUS commands like FWdelete or FWupgrade can be executed by the FUS.

Let’s erase all the code located in the unsecure area (from 0x08000000 to the SFSA pointer).

To do that, set the RDP level to 0xBB and then revert to 0xAA. Do this in to successive commands. This will erase all data in the unsecure region.

Then let’s see what happen if you issue a new FWdelete command.

Remi QUINTIN
ST Employee

I see​ in your log that

PCROP1A_STRT : 0x1FF (0x8000FF8)

 PCROP1A_END : 0x0 (0x8000008)

 PCROP_RDP   : 0x0 (PCROP zone is kept when RDP is decreased)

 PCROP1B_STRT : 0x1FF (0x8000FF8)

 PCROP1B_END : 0x0 (0x8000008)

Normally when there is no protected areas, the PCROP_RDP bit should be set to 1. This could prevent the mass erase we want to do in the unsecure area. So please set this PCROP_RDP option byte to 1.

HKIM.13
Associate II

Oh, it works, and I successfully delete the FW. Thanks for nice tip.

However, updating FUS is still not possible, but ble_stack download is done without problem.

Log below is the FUS update error message, and I guess.... this could means that I already have proper FUS version.

%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1

  -------------------------------------------------------------------

      STM32CubeProgrammer v2.2.1

  -------------------------------------------------------------------

ST-LINK SN : 48FF77068280514930450181

ST-LINK FW : V2J33S0

Voltage  : 2.88V

SWD freq : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID : 0x495

Device name : STM32WBxx

Flash size : 512 KBytes

Device type : MCU

Device CPU : Cortex-M0+/M4

UPLOADING OPTION BYTES DATA ...

 Bank   : 0x00

 Address  : 0x58004020

 Size   : 104 Bytes

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

PROGRAMMING OPTION BYTES AREA ...

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Byte: nswboot0, value: 0x0, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.284

Firmware Upgrade process started ...

Memory Programming ...

Opening and parsing file: FUS_Operator.bin

 File   : FUS_Operator.bin

 Size   : 16882 Bytes

 Address  : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.126

Verifying ...

Read progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%

Download verified successfully

Application is running

Reconnecting...

Reconnected !

Error: FUS_STATE_IMG_NOT_AUTHENTIC

Error: fwupgrade Command Failure!

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

Error: failed to download Segment[0]

Error: failed to download the File

Time elapsed during download operation: 00:01:00.359

Error: Failed to download image!

HKIM.13
Associate II

It worked and I successfully delete the fw and install BLE stack again, but, still failing for updating FUS.

%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1

  -------------------------------------------------------------------

      STM32CubeProgrammer v2.2.1

  -------------------------------------------------------------------

ST-LINK SN : 48FF77068280514930450181

ST-LINK FW : V2J33S0

Voltage  : 2.88V

SWD freq : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID : 0x495

Device name : STM32WBxx

Flash size : 512 KBytes

Device type : MCU

Device CPU : Cortex-M0+/M4

UPLOADING OPTION BYTES DATA ...

 Bank   : 0x00

 Address  : 0x58004020

 Size   : 104 Bytes

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

PROGRAMMING OPTION BYTES AREA ...

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Byte: nswboot0, value: 0x0, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.284

Firmware Upgrade process started ...

Memory Programming ...

Opening and parsing file: FUS_Operator.bin

 File   : FUS_Operator.bin

 Size   : 16882 Bytes

 Address  : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.126

Verifying ...

Read progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%

Download verified successfully

Application is running

Reconnecting...

Reconnected !

Error: FUS_STATE_IMG_NOT_AUTHENTIC

Error: fwupgrade Command Failure!

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

Error: failed to download Segment[0]

Error: failed to download the File

Time elapsed during download operation: 00:01:00.359

Error: Failed to download image!

Oh, it did work and successfully fwdelete worked, and installing ble_stack had no problem, but still only failing for updating FUS.

Maybe, it could means that I already have proper FUS version.

%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1

  -------------------------------------------------------------------

      STM32CubeProgrammer v2.2.1

  -------------------------------------------------------------------

ST-LINK SN : 48FF77068280514930450181

ST-LINK FW : V2J33S0

Voltage  : 2.88V

SWD freq : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID : 0x495

Device name : STM32WBxx

Flash size : 512 KBytes

Device type : MCU

Device CPU : Cortex-M0+/M4

UPLOADING OPTION BYTES DATA ...

 Bank   : 0x00

 Address  : 0x58004020

 Size   : 104 Bytes

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

PROGRAMMING OPTION BYTES AREA ...

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Byte: nswboot0, value: 0x0, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.284

Firmware Upgrade process started ...

Memory Programming ...

Opening and parsing file: FUS_Operator.bin

 File   : FUS_Operator.bin

 Size   : 16882 Bytes

 Address  : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.126

Verifying ...

Read progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%

Download verified successfully

Application is running

Reconnecting...

Reconnected !

Error: FUS_STATE_IMG_NOT_AUTHENTIC

Error: fwupgrade Command Failure!

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

Error: failed to download Segment[0]

Error: failed to download the File

Time elapsed during download operation: 00:01:00.359

Error: Failed to download image!

HKIM.13
Associate II

Oh, it did work and successfully fwdelete worked, and installing ble_stack had no problem, but still only failing for updating FUS.

Maybe, it could means that I already have proper FUS version.

%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1

  -------------------------------------------------------------------

      STM32CubeProgrammer v2.2.1

  -------------------------------------------------------------------

ST-LINK SN : 48FF77068280514930450181

ST-LINK FW : V2J33S0

Voltage  : 2.88V

SWD freq : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID : 0x495

Device name : STM32WBxx

Flash size : 512 KBytes

Device type : MCU

Device CPU : Cortex-M0+/M4

UPLOADING OPTION BYTES DATA ...

 Bank   : 0x00

 Address  : 0x58004020

 Size   : 104 Bytes

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

PROGRAMMING OPTION BYTES AREA ...

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Byte: nswboot0, value: 0x0, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.284

Firmware Upgrade process started ...

Memory Programming ...

Opening and parsing file: FUS_Operator.bin

 File   : FUS_Operator.bin

 Size   : 16882 Bytes

 Address  : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

File download complete

Time elapsed during download operation: 00:00:01.126

Verifying ...

Read progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%

Download verified successfully

Application is running

Reconnecting...

Reconnected !

Error: FUS_STATE_IMG_NOT_AUTHENTIC

Error: fwupgrade Command Failure!

Download firmware image at address 0x807a000 ...

Memory Programming ...

Opening and parsing file: stm32wb5x_FUS_fw.bin

 File   : stm32wb5x_FUS_fw.bin

 Size   : 24492 Bytes

 Address  : 0x0807A000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [122 127]

Download in Progress:

栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%

Error: failed to download Segment[0]

Error: failed to download the File

Time elapsed during download operation: 00:01:00.359

Error: Failed to download image!

I think i have the same problem with my stm32wb55ceu6. I think there might be a problem with the FUS-binary installed. Could you maybe explain how to set the RDP level to 0xBB and revert to 0xAA? I have only found the option to set the rdp level to 1 with the command provided in you bash script.

Thanks in advance.

Remi QUINTIN
ST Employee

​You have to add in your batch file the 2 lines below

set comport=SWD or USB or UART depending on your board

CLI.exe -c port=%comport%   -ob RDP=0xBB

CLI.exe -c port=%comport%   -ob RDP=0xAA

FPro.1
Associate II

Thank you very much for your answer. I managed to do it in the GUI of the CubeProgrammer. It is working now for me although I used different RAM addresses and not the ones in your batch file. (Maybe they are not valid anymore... I used the ones specified in the .html of the firmware package folder)

RLour.1
Associate II

This is a very complicated part to set up....

I am not able to do the first step of erasing firmware. Any suggestions?

Thanks

Rich

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD -fwdelete
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.6.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 066FFF545057717867194739
ST-LINK FW  : V2J30M20
Board       : P-NUCLEO-WB55
Voltage     : 3.26V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev B
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M4
 
Warning: Option Byte: nSWboot0, value: 0x0, was not modified.
Warning: Option Byte: nboot0, value: 0x1, was not modified.
Warning: Option Byte: nboot1, value: 0x1, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Succeeded to set nSWboot0=0 nboot1=1 nboot0=1
 
 
Memory Programming ...
Opening and parsing file: 0x495_FUS_Operator.bin
  File          : 0x495_FUS_Operator.bin
  Size          : 11584 Bytes
  Address       : 0x08000000
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
Download in Progress:
██████████████████████████████████████████████████ 100%
 
File download complete
Time elapsed during download operation: 00:00:00.350
Application is running
Reconnecting...
Reconnected !
Error: FUS_STATE_ERR_UNKNOWN
Firmware delete n░1 failed after retrying!
Warning: Option Byte: nSWboot0, value: 0x0, was not modified.
Warning: Option Byte: nboot0, value: 0x1, was not modified.
Warning: Option Byte: nboot1, value: 0x1, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Succeeded to set nSWboot0=0 nboot1=1 nboot0=1
 
 
Memory Programming ...
Opening and parsing file: 0x495_FUS_Operator.bin
  File          : 0x495_FUS_Operator.bin
  Size          : 11584 Bytes
  Address       : 0x08000000
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
Download in Progress:
██████████████████████████████████████████████████ 100%
 
File download complete
Time elapsed during download operation: 00:00:00.327
Application is running
Reconnecting...
Reconnected !
Error: FUS_STATE_ERR_UNKNOWN
Firmware delete n░1 failed after retrying!
Warning: Option Byte: nSWboot0, value: 0x0, was not modified.
Warning: Option Byte: nboot0, value: 0x1, was not modified.
Warning: Option Byte: nboot1, value: 0x1, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Succeeded to set nSWboot0=0 nboot1=1 nboot0=1
 
 
Memory Programming ...
Opening and parsing file: 0x495_FUS_Operator.bin
  File          : 0x495_FUS_Operator.bin
  Size          : 11584 Bytes
  Address       : 0x08000000
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
Download in Progress:
██████████████████████████████████████████████████ 100%
 
File download complete
Time elapsed during download operation: 00:00:00.326
Application is running
Reconnecting...
Reconnected !
Error: FUS_STATE_ERR_UNKNOWN
Firmware delete n░1 failed after retrying!
Error: fwdelete Operation Failure! Please, try again
 
 
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>