2019-12-11 02:08 AM
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
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.
Solved! Go to Solution.
2019-12-12 07:39 AM
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.
2019-12-11 03:46 AM
Hi, there is UM2237, that describes CubeProg_CLI commands.
Generally you just need to change "port=usb1" to "port=swd mode=ur"
You need CubeProgrammer at least v2.2 to use SWD for this purpose
2019-12-11 04:56 AM
2019-12-11 10:16 PM
Thank you so much for you guys @Community member & @Remi QUINTIN , it was great step forward for me.
However, I still got some problem.
I have an error message while updating the FUS and I attach the log
For basic information, I'm using fw version 1.3.0. and my install address is 0x807a000 according to the release note (STM32WB55CEUx), I'm keeping my boot0 pin connected to VDD for whole process.
I don't have any idea about
Error: FUS_STATE_IMG_NOT_AUTHENTIC
this message...
Since I'm using SWD, I cannot check my FUS version (as far as I know).
Fortunately, If I skip updating FUS and directly install the ble stack, then my original problem is resolved, but I still cannot scanning my ble device at smartphone(Galaxy S10 5G). It is obvious that APP_BLE_Init() function is properly ended.
So, I want to know...
2019-12-12 02:58 AM
A few remarks regarding your log.
It is not mandatory to start with a -rdu command but it should have no impact as it is not activating the FUS.
Then the fwelete command seems difficult. each time the FUS_operator is downloaded, it failed at reconnection with a FUS_STATE_ERR_UNKNOWN message... and in the ends it gave up.
Then I see this strange multi line command which looks like 3 times the same command
%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1%PROG% -c port=swd mode=UR -ob nSWboot0=0 nboot1=1 nboot0=1 -fwupgrade %FUS_BIN% 0x0807A000 firstinstall=1
Only one 1 OK => this explain why you got this repetitive trial of the FUS upgrade though the Firmware Upgrade is a Success
This is why you get the second error message FUS_STATE_IMG_NOT_AUTHENTIC.
This one is issued when the FUS version of the new FUS is the same as the current one.
Could you download all the option bytes to understand the final status of the board?
2019-12-12 03:00 AM
In the end I expect the SFSA to be 0xF4
Then try to redo a fwdelete commande and then load the RF stack.
2019-12-12 06:18 AM
2019-12-12 06:20 AM
2019-12-12 06:27 AM
You are applying the same batch file (I still see the 3 same calls) and so it is not unexpected that it produces the same result.
let's doing this step by step.
First, just call the fwdelete command and then show me the Option byte.
2019-12-12 07:01 AM
Oh, FW_Delete_LOG is the new one, I'll write down the log
Microsoft Windows [Version 10.0.18362.535]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\wagne>@echo off
SET PROG="C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe"
SET BIN_PATH=C:\Users\wagne\STM32Cube\Repository\STM32Cube_FW_WB_V1.3.0\Projects\STM32WB_Copro_Wireless_Binaries\
SET APPLI_PATH=C:\STM32Cube_FW_WB_VX.Y.Z\STM32Cube_FW_WB_V1.3.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\
SET DONGLE=C:\STM32Cube_FW_WB_VX.Y.Z\STM32Cube_FW_WB_V1.3.0\Projects\P-NUCLEO-WB55.USBDongle\Applications\BLE\
set comport=SWD
echo Connected with %comport%
Connected with SWD
REM Command list
SET S0=%PROG% -c port=%comport% -rdu
SET DOWNLOAD=%PROG%
REM FW list
SET RF_STACK_BIN=%BIN_PATH%stm32wb5x_BLE_Stack_fw.bin
SET FUS_BIN=%BIN_PATH%stm32wb5x_FUS_fw.bin
SET HCIlayer_BIN=%BIN_PATH%stm32wb5x_BLE_HCILayer_fw.bin
SET Mac_BIN=%BIN_PATH%stm32wb5x_Mac_802_15_4_fw.bin
SET rfMon_BIN=%BIN_PATH%stm32wb5x_rfmonitor_phy802_15_4_fw.bin
SET ThreadFTD_BIN=%BIN_PATH%stm32wb5x_Thread_FTD_fw.bin
SET ThreadMTD_BIN=%BIN_PATH%stm32wb5x_Thread_MTD_fw.bin
SET Zigbee_BIN=%BIN_PATH%stm32wb5x_zigbee_full_fw.bin
%PROG% -c port=SWD -fwdelete
-------------------------------------------------------------------
STM32CubeProgrammer v2.2.1
-------------------------------------------------------------------
ST-LINK SN : 48FF77068280514930450181
ST-LINK FW : V2J33S0
Voltage : 2.90V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x495
Device name : STM32WBxx
Flash size : 512 KBytes
Device type : MCU
Device CPU : Cortex-M0+/M4
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:00.994
Verifying ...
Read progress:
栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%
Download verified successfully
Application is running
Reconnecting...
Reconnected !
Error: FUS_STATE_ERR_UNKNOWN
Firmware delete n? failed after retrying!
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]
failed to erase memory
failed to erase memory
Failed to download FUS operator!
Firmware delete n? failed after retrying!
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.065
Verifying ...
Read progress:
栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢굇굇굇굇굇굇굇 100%
Download verified successfully
Application is running
Reconnecting...
Reconnected !
Error: FUS_STATE_ERR_UNKNOWN
Firmware delete n? failed after retrying!
Error: fwdelete Operation Failure! Please, try again
%PROG% -c port=swd -ob displ
-------------------------------------------------------------------
STM32CubeProgrammer v2.2.1
-------------------------------------------------------------------
ST-LINK SN : 48FF77068280514930450181
ST-LINK FW : V2J33S0
Voltage : 2.89V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software 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%
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)
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 : 0x0 (0x0)
Security Configuration Option bytes:
ESE : 0x1 (Security enabled)
SFSA : 0x57 (0x57)
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 : 0x15C00 (0x15C00)
PCROP Protection:
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)
Write Protection:
WRP1A_STRT : 0xFF (0x807F800)
WRP1A_END : 0x0 (0x8000000)
WRP1B_STRT : 0xFF (0x807F800)
WRP1B_END : 0x0 (0x8000000)
Deleting process is keep failing through multiple trials.