APB clock to RTC required for the RTC to be able to wake from sleep?
I find that I need to enable the APB clock to the RTC during sleep (i.e. by setting the RTCAPBSMEN bit in the RCC APBSMENR1 register) otherwise my code won’t wake after calling __WFI(); is the AI explanation below correct? The AI also says it’s EXTI line 20, whereas the manual (RM0503 Rev. 2) indicates RTC on 28 and TAMP on 29, so I assume it’s wrong about that?
The AI answer:
- In Sleep mode, the CPU is halted but the APB bus remains active — if the corresponding APBSMEN bits are set.
- If RTCAPBSMEN is cleared, the RTC peripheral’s APB interface is clock-gated, meaning you can’t access its registers — and more importantly, EXTI line 20 won’t see the RTC wakeup event, because the EXTI-RCC bridge path is broken.
So even though the RTC’s core logic is ticking away on LSE, the event routing to EXTI and the ability to clear flags depends on that APB interface being live.
