Unexpected Behavior with RTC ALARM_A in LowPoer Mode on STM32WB55
Hello everyone,
I’m working with an STM32WB55 microcontroller with BLE stack. I use also low-power modes in my app. Before entering a low-power mode, I set an RTC ALARM_A to wake the system up at a specific time. The device then enters either Sleep or STOP2 mode with the RTC enabled.
However, I’m noticing an issue where, when in these low-power modes, the RTC ALARM_A does not seem to wake the device as expected. The timing appears to freeze or behave unpredictably, and the alarm sometimes triggers late or not at all.
Here is the output just before entering sleep mode with the configured alarm:
Current time vs Alarm RTC Settings:
(PREDIV_S = maximal SubSec = 32000)
| Field | Current (Cur) | Alarm (Alm) |
|------------|------------|--------|
| SubSec | 7234 | 6594|
| Sec | 21 | 21 |
| Min | 0 | 0 |
| Hr | 0 | 0 |
| Day | 1 | 1 |
| Mon | 1 | 1 |
| Yr | 0 | 0 |
When I pause the execution, I see that the program is halted right after the WFI() instruction. I also see that the current time is much further ahead (by the duration I was stuck), the seconds were already at 25.

All the relevant registers appear to be configured correctly for the RTC ALARM_A interrupt:
- The RTC_CR register has the ALRAIE bit (Alarm A interrupt enable) set to 1, so the RTC ALARM_A interrupt is enabled.
- The EXTI_IMR register has bit 17 set to 1, which means the interrupt for the RTC ALARM is unmasked (enabled).
- The EXTI_RTSR bit 17 set to 1
- The interrupt for RTC ALARM is enabled in the NVIC.
Has anyone else encountered similar issues with RTC alarms in these low-power modes? Could there be any configuration or known issue that might cause this behavior?
Any insights or suggestions would be greatly appreciated!
