2025-10-28 6:05 AM - edited 2025-10-28 7:21 AM
Hello everyone,
I’m working on a project using the STM32WB55RG microcontroller with FreeRTOS, and I’m trying to put the MCU into STOP Mode 2. The system is supposed to wake up regularly using the RTC.
I’m using LL libraries to configure the power registers for STOP Mode 2. However, when I reach the _WFI() instruction, the MCU does not actually enter stop mode—it simply continues normal execution instead of waiting.
Has anyone experienced a similar issue? Are there any specific configurations, prerequisites, or FreeRTOS-related considerations I might be missing?
Any suggestions or debugging tips would be greatly appreciated.
Thank you in advance for your help!
Here is my code piece:
void EnterStop2Mode(uint32_t seconds)
{
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc); // Ensure wake-up timer is reset
uint16_t rtc_counter = RTC_CalculateWakeUpCounter(seconds);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, rtc_counter, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
/* Set Stop 2 mode of CPU2 */
/* Note: On STM32WB, both CPU1 and CPU2 must be in stop mode to set the entire system in stop mode */;
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
/* Set SLEEPDEEP bit of Cortex System Control Register */
LL_LPM_EnableDeepSleep();
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Request Wait For Interrupt */
__WFI();
}
Best regards,