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

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
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 Employee

​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

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>

Remi QUINTIN
ST Employee

​Can you download the option bytes with this command?

STM32_Programmer_CLI.exe -c port=SWD -ob displ

RLour.1
Associate II

Here is the output

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD -ob displ
      -------------------------------------------------------------------
                       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%
 
 
OPTION BYTES BANK: 0
 
   Read Out Protection:
 
     RDP          : 0xAA (Level 0, no protection)
 
   BOR Level:
 
     BOR_LEV      : 0x0 (BOR Level 0 reset level threshold is around 1.7 V)
 
   User Configuration:
 
     nBOOT0       : 0x1 (nBOOT0=1 Boot from main Flash)
     nBOOT1       : 0x1 (Boot from code area if BOOT0=0 otherwise system Flash)
     nSWBOOT0     : 0x0 (BOOT0 taken from the option bit nBOOT0)
     SRAM2RST     : 0x0 (SRAM2 erased when a system reset occurs)
     SRAM2PE      : 0x1 (SRAM2 parity check disable)
     nRST_STOP    : 0x1 (No reset generated when entering the Stop mode)
     nRST_STDBY   : 0x1 (No reset generated when entering the Standby mode)
     nRSTSHDW     : 0x1 (No reset generated when entering the Shutdown mode)
     WWDGSW       : 0x1 (Software window watchdog)
     IWGDSTDBY    : 0x1 (Independent watchdog counter running in Standby mode)
     IWDGSTOP     : 0x1 (Independent watchdog counter running in Stop mode)
     IWDGSW       : 0x1 (Software independent watchdog)
     IPCCDBA      : 0x3  (0x3)
 
   Security Configuration Option bytes - 1:
 
     ESE          : 0x1 (Security enabled)
 
   PCROP Protection:
 
     PCROP1A_STRT : 0x1FF  (0x80FF800)
     PCROP1A_END  : 0x0  (0x8000800)
     PCROP_RDP    : 0x0 (PCROP zone is kept when RDP is decreased)
     PCROP1B_STRT : 0x1FF  (0x80FF800)
     PCROP1B_END  : 0x0  (0x8000800)
 
   Write Protection:
 
     WRP1A_STRT   : 0xFF  (0x80FF000)
     WRP1A_END    : 0x0  (0x8000000)
     WRP1B_STRT   : 0xFF  (0x80FF000)
     WRP1B_END    : 0x0  (0x8000000)
OPTION BYTES BANK: 1
 
   Security Configuration Option bytes - 2:
 
     SFSA         : 0xD0  (0xD0)
     FSD          : 0x0 (System and Flash secure)
     DDS          : 0x1 (CPU2 debug access disabled)
     C2OPT        : 0x1 (SBRV will address Flash)
     NBRSD        : 0x1 (SRAM2b is non-secure)
     SNBRSA       : 0x14  (0x14)
     BRSD         : 0x1 (SRAM2a is non-secure)
     SBRSA        : 0xA  (0xA)
     SBRV         : 0x3D800  (0x3D800)
 
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>

Remi QUINTIN
ST Employee

It seems the SBRV value (0xF6) is pointing to an old version of the FUS.

To avoid any weird result, you should first upgrade the FUS to v1.0.2 and then to V1.1.0.

Please read the releases notes under directory STM32Cube_FW_WB_V1.10.0\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x

Then select the stm32wb5x_FUS_fw_1_0_2.fin file to first upgrade the FUS to V1.0.2 and then use stm32wb5x_FUS_fw.bin file to upgrade the FUS to V1.1.0.

Those binaries are 6 sectors big (24KB). So you should load those binaries 6x 0x1000 below address 0x080D000 = 0x080CA0000.

What is strange is the value of the SFSA option byte: 0xD is not an expected value as it seems a FW had already been uploaded/programed. So It is not clear no me why you cannot erase it.

So, upgrade the FUS to its latest version and then try the fwfelete command again.

Could you tell what baord are you usning , The Nucleo board or your custom board?

RLour.1
Associate II

This is a standard P-NUCLEO_WB55.

I have 5 and 7 jumpered together on CN7 and JP1 set to USB_MCU. RED LED4 lights. nothing appears on the PC indicating a serial port. That does not seem like a good thing.

Any more suggestions?

How to flash the Wireless Coprocessor Binary via USB (Command Line Interface)

  • Inside the below procedure, the references to binaries name and install address are provided in the section Main Changes of this file.
  • STEP 1: Use STM32CubeProgrammer
    • Version 2.0 or higher.
    • It gives access to Firmware Upgrade Service (FUS) (AN5185 : ST firmware upgrade services for STM32WB Series.) through Bootloader.
    • It is currently available as Command Line Interface (CLI) mode.
  • STEP 2: Access to Bootloader USB Interface (system flash)
  • Boot mode selected by Boot0 pin set to VDD
  • For P-NUCLEO-WB55.Nucleo :
    • Jumper between CN7.5(VDD) and CN7.7(Boot0)
      • Power ON via USB_USER and Jumper JP1(USB_MCU)
  • For P-NUCLEO-WB55.USBDongle :
    • Move switch SW2 to Boot0
      • Connect P-NUCLEO-WB55.USBDongle

There is no device to connect to do download anything.

RLour.1
Associate II

I was able to program those images using the GUI STM32CubeProgrammer from the STLINK if. This address, 0x080CA000, works better than than 0x080CA0000. I still don't see a bootloader when BOOT0 is jumpered CN7.5 to CN7.7 and I am connected to the USER USB and JP1 in the USB_MCU position.

RLour.1
Associate II

I am about ready to punt on this and switch to an NR52840