STM32L431 can't enter STOP2 mode
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?
