Search code examples
stm32real-time-clock

STM32F429 Why I can't read RTC?


I have a question about the RTC on STM43F429. I have a board that manages the RTC date and Time with a battery backup. After some test I have this problem: after a reset , when I try to read the RTC time for the first time, the RTC seems stopped (I see hh:mm:ss stipped) but if I look at the internal RTC register (with debugger) all is OK... so I cant read the current time. To solve this I have to read the date before and then I can read the time and the RTC is running correctly.. I don't understand why I have to read the date before to read the time. Can someone explay this? Thanks


Solution

  • You need wait when data from RTC will be synchronised with their shadow registers, it is every two RTC clocks, and can be checked with RTC_ISR.RSF (Registers Synchronisation Flag).

    More info is in Reference manual section 26.3.2 Real-time clock and calendar.