This article presents some general recommendations about how to debug and get access to the STM32WB0 series devices when low-power mode is enabled.
1. Debug application in low-power mode
There are certain situations where debug access is disabled and the STM32WB0 series device cannot be accessed, including:
- An application that disables the SWD debug pins (SWDIO: PA2; SWCLK: PA3)
- An application that puts the device in Deepstop mode with or without the low-speed clock, where the SWD debug port is not powered
These cases are common during application development and the device can end up in a state where debug access is no longer possible.
To recover the device, the following is recommended:
- Do not enable the low-power mode by setting CFG_LPM_SUPPORTED to 0 in the
app_conf.h
file of the related application, available in the applicationCore\Inc
folder. - Configure a GPIO to wake up the system and grant access to the debugger. For example, configure a wake-up source on GPIO PA0:
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PA0, PWR_WUP_FALLEDG);
- When debugger access is needed, the user must force the wake-up I/O (PA0 in the example) to a low value and then use "Attach to running target" in the debugger.
2. Device access with application in low-power mode
An STM32WB0x application like BLE_Beacon configures the STM32WB0 series device to enter Deepstop mode when allowed.
When the STM32WB0 device is in Deepstop mode, the SWD port is disabled. Consequently, SWD access is disabled and the chip cannot be accessed/programmed through SWD. In this case, the user can:
- Activate the device UART bootloader by setting the PA10 pin to a high value.
- Perform a reset cycle of the device (keeping PA10 at a high value).
For example, when using a NUCLEO-WB09KE board, the user can put the JP1 jumper in bootloader position and perform a hardware reset through the B4 button. This allows the activation of the UART bootloader and programs a new application through the SWD channel.
After programming, the user must remove the JP1 jumper.
These recommendations also apply for NUCLEO-WB07CC and NUCLEO-WB05KZ kits.
NUCLEO-WB09KE UART bootloader activation and application programming through SWD |
---|
An alternative approach is to perform a mass erase of the device using the STM32CubeProgrammer tool in
UART mode, and then program a new application through the SWD channel.