Skip to main content
HKIM.13
Associate
December 11, 2019
Solved

STM32WB55CEUx custom board ble stack updating.

  • December 11, 2019
  • 32 replies
  • 8656 views

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.

This topic has been closed for replies.
Best answer by Remi QUINTIN

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.

32 replies

HKIM.13
HKIM.13Author
Associate
December 12, 2019

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
HKIM.13Author
Associate
December 12, 2019

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!

HKIM.13
HKIM.13Author
Associate
December 12, 2019

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!

Remi QUINTIN
ST Technical Moderator
March 5, 2020

​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
March 5, 2020

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
February 11, 2021

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>

Remi QUINTIN
ST Technical Moderator
February 11, 2021

FUS_STATE_ERR_UNKNOWN error message means the FUS is not activated. This can happen when you were just running your application SW. In that case the M0+ core is running the RF stack.

To wake it up, you have to issue the FUS get State command below.

 %PROG% -c port=SWD mode=UR -fusgetstate

With this command you switch the M0+ core to execute security services: The FUS will then execute any secure commands like fwdelete or fwupgrade.

RLour.1
Associate II
February 11, 2021
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD mode=UR -fusgetstate
 -------------------------------------------------------------------
 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: Under Reset
Reset mode : Hardware reset
Device ID : 0x495
Revision ID : Rev B
Device name : STM32WBxx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
 
Error: -fusgetstate command is not available for SWD interface.
 
 
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>

Hmm. what next?

Remi QUINTIN
ST Technical Moderator
February 11, 2021

​Gosh!! I forgot this limitation on the SWD side. Note that this limitation will be removed in the future.

Ok just try the 2 commands below before sending the fwdelete command:

REM %PROG% -c port=swd -ob RDP=0xAA

REM %PROG% -c port=swd -rdu

Let me know then if it works.

RLour.1
Associate II
February 12, 2021

Similar results

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -ob RDP=0xAA
 -------------------------------------------------------------------
 STM32CubeProgrammer v2.6.0
 -------------------------------------------------------------------
 
ST-LINK SN : 066FFF545057717867194739
ST-LINK FW : V2J37M26
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
 
 
UPLOADING OPTION BYTES DATA ...
 
 Bank : 0x00
 Address : 0x58004020
 Size : 96 Bytes
 
██████████████████████████████████████████████████ 100%
 
 Bank : 0x01
 Address : 0x58004080
 Size : 8 Bytes
 
██████████████████████████████████████████████████ 100%
 
 
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: rdp, value: 0xAA, was not modified.
 
Warning: Option Bytes are unchanged, Data won't be downloaded
 
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -rdu
 -------------------------------------------------------------------
 STM32CubeProgrammer v2.6.0
 -------------------------------------------------------------------
 
ST-LINK SN : 066FFF545057717867194739
ST-LINK FW : V2J37M26
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
 
 
Disabling memory Read Protection...
Warning: Option Byte: rdp, value: 0xAA, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
 
Memory Read Protection disabled successfully
 
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 : V2J37M26
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.369
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.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.351
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>