2019-05-22 01:23 PM
I'm trying to enter STOP2 mode to save energy but the MCU get stuck in the function HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI). I have cleared all EXTI pending flags and RTC flags, and disable all five wake up pins. The MCU is supposed to wake up via RTC alarm interrupt. The program resumes by clearing RTC flag and calling system clock config and gpio init functions.
I have done this with STANDBY and SHUTDOWN modes without trouble, and I can't understand why I can't enter STOP2 mode as well. Anyone has got an idea?
Solved! Go to Solution.
2019-05-25 01:35 AM
@Alex R already mentioned how to disable the extra peripherals.
Clearing interrupts is done by clearing the EXTI interrupt pending bits and NVIC interrupt pending bits.
They don't stay cleared, if there is a peripheral interrupting, though.
The pod can be used if the DBG_STOP bit is set in DBGMCU_CR.
2019-05-29 06:16 AM
[RESOLVED] Thank you all, your advices have been useful and convicing!
Finally, I could get it working by disabling SysTick interrupt and then resuming the interrupt when the MCU wakes up.