2024-08-15 04:49 AM
I would like to use the Stop3 low-power mode on an STM32U545RE (NUCLEO-U545RE-Q board) and to wake-up the device by the RTC. I have a working example for Stop2 mode for which I largely used the inspiration from the stm32u5 workshop. But when I replace the HAL_PWREx_EnterSTOP2Mode call(s) with HAL_PWREx_EnterSTOP3Mode, the device does not wake up from the stop mode anymore. At least the current consumption drops down to 3uA so I am confident that the Stop3 mode itself is working.
The code parts of my main function which I believe are relevant look as follows:
HAL_Init();
SystemClock_Config();
SystemPower_Config();
MX_GPIO_Init();
MX_ICACHE_Init();
MX_RTC_Init();
/* The SMPS regulator supplies the Vcore Power Domains */
HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY);
/* Enable ultra low power mode */
HAL_PWREx_EnableUltraLowPowerMode();
/* Enable the Autonomous Mode for the RTC Stop0/1/2 */
__HAL_RCC_RTCAPB_CLKAM_ENABLE();
/* Set RTC wakeup timer for 2s */
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 2, RTC_WAKEUPCLOCK_CK_SPRE_16BITS, 0);
/* Enter in Stop 3 mode */
HAL_PWREx_EnterSTOP3Mode(PWR_STOPENTRY_WFI);
Is there anything missing to make the RTC (interrupt) work in Stop3 mode? In the reference manual, I found that the RTC should be able to run and to wake up the CPU from Stop3 mode but I guess some configuration is missing here. Thanks in advanve for any helpful advice.
2024-08-15 05:50 AM - edited 2024-08-15 05:51 AM
Hello @TNaum ,
this is quite the expected behavior because there is a sequence which should be respected when entering and exiting from stop 3 this sequence is described in section 10.7.9 (Stop 3 mode) of RM0456.
you can see a working implementation provided in cube firmware U5 detailing entering and exiting from all stop modes using RTC.STM32CubeU5/Projects/NUCLEO-U575ZI-Q/Examples/PWR/PWR_LPMODE_RTC at main · STMicroelectronics/STM32CubeU5 (github.com).
see the sequence in main.c:
/* STOP3 wake up global interrupt configuration */
HAL_NVIC_SetPriority(PWR_S3WU_IRQn, 7, 7);
HAL_NVIC_EnableIRQ(PWR_S3WU_IRQn);
Regards