2022-11-24 12:55 AM
I am facing a problem when trying to wake up from Stop2Mode. I am able to come out of stop2mode from an external interrupt with no problem but when using wakeuptimer interrupt the unit doesn't wake up.
I have tried that setting the wakeup timer interrupt (HAL_RTCEx_SetWakeUpTimer_IT) works without going into stop2mode, so I can see a simple led flashes every time the interrupt is generated.
For checking that the RTC is still working when going into stop2mode, I have set up 2 interrupts, one external and the wakeup timer, I get the time from the RTC before going into stop2mode and then when the external interrupt is generated, the time from the RTC is working okay even though I am still not able to wake up from the wakeup timer interrupt.
If I run the same program under the debugger (ST-LINK) the unit will wake up generating generating a wakeup timer interrupt but if don't run it under the debugger, the unit won't generate the wakeup timer interrupt.
Any ideas why this could be?
Note: I have used 32L4 and all worked okay
Thanks
2022-11-25 12:14 AM
Hello @jampino,
Please refer to the errata sheet STM32U575xx and STM32U585xx device errata, and check the RTC wakeup timer interrupt limitation in section 2.2.4.
For that, make sure that the wakeup timer flag (RTC_SCR_CWUTF) is cleared in the interrupt subroutine before getting a new trigger.
Also, I advise you to get inspired from the available PWR_LPMODE_RTC example in the STM32CubeU5 MCU package.
I hope this helps!
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Thank you.
Kaouthar
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.
2022-11-25 07:06 AM
Hello @KDJEM.1
Thanks for your response. I have change the code to use LPTIM now, the interrupt seems to be called, I have got two callbacks when the interrupt is generated ( HAL_LPTIM_AutoReloadMatchCallback() and HAL_LPTIM_UpdateEventCallback()) but there is something rather strange and I am not sure why but if I run the code under the debugger the unit will go into stop2mode and the interrupt will be generated every 20 secs as expected but if I just run the code without using the debugger, the unit will go into stop2mode but the interrupt won't be called.
Any idea why I could have this problem?
Thank you
2022-11-30 06:23 AM
Hello @jampino
Not all peripherals are able to wake up the U5 from Stop0/1/2 modes. All TIMx for example are not capable, you may need to use LPTIMx as described in RM0456 "Table 89. Functionalities depending on the working mode (1) (continued)"
Best Regards,
Younes