2023-06-29 06:54 AM - edited 2023-06-29 07:39 AM
I am trying to configure the RTC wakeup functionality to wake the system from STOP2 mode every 60s. I am using the 1 Hz ck_spre clock and setting the WUTR register to 60 using the HAL api
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 60, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
I have then overloaded the `HAL_RTCEx_WakeUpTimerEventCallback` callback to call another function whenever the timer expires. If I do not enter STOP2 mode, then the timer fires and the callback executes as expected, so all of this should be set up properly. If I enter STOP2 mode, the IRQ no longer executes. If I stop the MCU using the debugger after IRQ should have fired, then continue the execution, the callback immediately executes. The correct EXTI->PR1 bit is set (bit 19) when I pause with the debugger, but it does not actually execute the IRQ until I wake up the MCU using the debugger.
I have tried manually setting the `RTSR1` register and the `C1IMR1` register to enable the EXTI line 19 rising interrupt, but I've also noticed that the correct bits are set using the debugger, even before I set them manually.
What could be preventing the RTC WKUP event from waking up the MCU?
EDIT: I've done a bit more debugging and confirmed that the behaviour is the same for STOP0 and STOP1 modes as well. It works when in SLEEP mode with both the main regulator and low power regulator, however.
2023-07-05 05:55 AM
Hello @ADing.1, thank you for your post,
Maybe the RTC wakeup interrupt is being masked by another interrupt?
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.