cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB15 immediately jumps out of standby mode after entering

robert_spyra
Associate

Hi together,

I am trying to enter standby mode on my stm32wb15 during ble application using the following code:

void UTIL_SEQ_PreIdle( void )
 
{
 
	if(Custom_App_Context.current_state == APP_SLEEP_STATE){
 
		HAL_SuspendTick();
 
		if(  (LL_PWR_IsActiveFlag_C1SB() == 0) || (LL_PWR_IsActiveFlag_C2SB() == 0))
 		{
			/* Set the lowest low-power mode for CPU2: shutdown mode */
 			LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
 		}
  
		/* Disable all used wakeup sources*/
 		HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
  
		/* Clear all related wakeup flags */
		__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
  
		HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
  
		/* Enter the Standby mode */
 		HAL_PWR_EnterSTANDBYMode();
 
		/* Program should never reach this point */
 		Error_Handler();
 
	}
 
}

The problem is like mentioned above that the mcu immediately jumps to main() after HAL_PWR_EnterSTANDBYMode(); . At this point the application has already cancelled advertising. What do i have to do?

Unfortunately the recommended way of entering low power modes, which is using the lpm module has not worked for me because when I change CFG_LPM_STANDBY_SUPPORTED to one, in CubeMX, my code is generated faulty. For example PWR_EnterOffMode() in stm32_lpm_if.c calls CPUcontextSave(); which is defined nowhere.

So both ways aren't working for me. What should I have to do?

Thank you in advance:smiling_face_with_smiling_eyes:

Regards,

Robert

2 REPLIES 2
Remy ISSALYS
ST Employee

Hello,

Standby mode will be fully functional in the next release (eg v1.14.0).

Best Regards

Piranha
Chief II

For wake-up pins the flag clearing must be the last operation with wake-up pins.

P.S. Yes, it's an undocumented "feature"...