2025-12-11 11:11 PM
I am working on an STM32 device with TrustZone enabled, and I am using the RTC with backup domain powered by VBAT. My RTC is initially configured while VDD is present, and after power-off, the time is supposed to be retained using VBAT.
When I use the LSI clock, the RTC initializes correctly, and the time is retained across power cycles. However, I observe some drift, so I switched to the LSE clock. With LSE, the drift problem is gone, but a new issue appears:
The RTC time is NOT retained when the system is powered from VBAT only.
After removing and restoring VDD, the RTC resets instead of keeping the previous time.
Details :
TrustZone is enabled in the project.
RTC + Backup domain is configured in the secure domain.
Powering the RTC from VBAT works when LSI is used but fails when LSE is used.
LSE crystal is soldered and oscillation appears stable.
VBAT is present and verified during power-off.
No backup registers or RTC clock settings seem to persist when using LSE.
1)What could cause the RTC not to retain time when LSE is selected, even though VBAT is present?
2)Are there additional configuration steps required in TrustZone (secure / non-secure) for LSE or the backup domain?
3)Could something be reinitializing or resetting the backup domain at boot when using LSE?
4)Any recommended steps to debug whether LSE is actually running during VBAT mode?