2023-08-17 02:25 AM
Hello,
I am new to this cpu and experimenting with RTC wakeup using 32kHz LSE. I am usingthis code for the wakeup:
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
{
SystemClock_Config();
HAL_ResumeTick();
...
}
// In while(1)
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x4E30, RTC_WAKEUPCLOCK_RTCCLK_DIV16, 0);
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
...
I removed the SetWakeUpTimer() function from MX_RTC_INIT().
It was working fine. I tweaked the MCU clock and generated the code with CubeIDE. I am not sure what went wrong but now its executing the callback (instead every 10s) instantly as fast as it can. I reverted everything i know about but still the same. Hope someone can give me a hint on what configurating i need to fix to make it work again.
Solved! Go to Solution.
2023-08-17 05:17 AM - edited 2023-08-17 05:17 AM
Hello @Fizzl92,
Try HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE;
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-08-17 05:17 AM - edited 2023-08-17 05:17 AM
Hello @Fizzl92,
Try HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE;
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-08-17 06:39 AM
Thank you very much! It works now with wake from Event. I did not know that RTC-wakeup is an event, not an interrupt. As in the CubeIDE calls it "RTC non-secure interrupt" i did not question it. And i think had it working once before with WFI...