Showing results for 
Search instead for 
Did you mean: 

Unable to use Standby Mode with STM32/WPAN BLE Package

Associate III

Board: STM32WB55
Software: STM32CubeIDE, STM32_WPAN BLE as Custom p2p server

Background: Have a test bench set up to check entering Standby Mode with additional features we want to use on our project before implementing it. Have been adding in our features and Standby Mode has been entered fine with good power consumption measured. I left the STM32_WPAN BLE package to last to add into the test project. This is my (edited) function WIP so far that is called when a button is pressed, using a flag system so not within the interrupt:




static void Enter_Standby_Mode() {
	/* Flash Green LEDs to signal Shut Down and ensure all are off */

	/* Specific procedure on STM32WB, in case of initial power-up and RF stack no started */
	if((LL_PWR_IsActiveFlag_C1SB() == 0) || (LL_PWR_IsActiveFlag_C2SB() == 0)) {
		/* Set the lowest low-power mode for CPU2: shutdown mode */

	/* Clear the RTC Wake UP (WU) flag */

	/* Clear the Wake Up FLAG */

	/* Set new RTC Wake Up Timer ~10s */
	if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x5AAA, RTC_WAKEUPCLOCK_RTCCLK_DIV16) != HAL_OK) {

       /* Set CPU2 into Standby Mode */

	/* Allow Low-Power Manager to Enter Standby State? 
         * This links to a function calling UTIL_LPM_SetOffMode(1 << CFG_LPM_APP_BLE, 

	/* Enter the Standby mode */

	/* Program should never reach this point (program restart when exiting from standby mode) */



Problem: This works fine, as per several examples, re-awakening form the RTC WU timer. However, simply adding in the STM32_WPAN package for BLE and generating the files with CubeMX, stops Standby Mode from working and it will now proceed to the Error_Handler.

I have scanned through app_conf.h for anything related and nothing seems to effect the outcome that is not the same in examples I have seen. I cannot seem to find the missing piece of this puzzle, I am not using debugger when expecting the power mode to change. The LPM and CPU2 are set into their respective low power states that should, as far as I am aware, allow the whole system to enter Standby. I have double checked registers during debugging and they are all set as expected in the reference manual,

Any clues would be much appreciated,


Associate II


One possible reason could be that the BLE stack is preventing the MCU from entering Standby mode. The BLE stack might be running on the CPU2 and if it's not properly put into a low-power state, it can prevent the system from entering Standby mode. You mentioned that you're calling the function `BLE_Enable_Standby()`, which seems to be setting the low-power mode for the BLE stack. But it is not clear from your code snippet what this function does exactly.


Currently, this is the code to try and stop CPU2:


void BLE_Enable_Standby() {
	/* Allow the Low-Power Manager of CPU2 to enter Standby */


It seems to hang the process for around 10 seconds for my Wake Up Alarm to trigger, but when it triggers it continues from 


and enters the Error_Handler, instead of resetting as expected. This would imply the CPU2 is entering a lower power state but not Standby Mode, so the whole system is restricted to the lowest common denominator, I will look into this more today, any further advice would be appreciated,