cancel
Showing results for 
Search instead for 
Did you mean: 

Updated time of RTC is not being read

Jumshed Akhtar
Associate II

I am running RTC for stm32h753. If I read the time of RTC, I do not get updated value as shown in below example. I am using LSE 32.768Khz. As it can be seen that 00:08:10  is being read repeatedly and then 00:08:15. if I compare overall time, it is correct but I want to get it once per sec correctly in my task. Is there any restriction that I need to set update rate to read the register once per sec? or any other suggestion!

hh:mm:sec

> 00:08:10 

> 00:08:10 

> 00:08:10 

> 00:08:10 

> 00:08:10 

> 00:08:15 

> 00:08:15 

.............

............

> 00:08:19 

> 00:08:19 

............

............

> 00:08:24 

......

> 00:08:27 

Best Regards,

2 REPLIES 2
Jumshed Akhtar
Associate II

I found that HAL_RTC_GetTime () needs to be called 1st and then HAL_RTC_GetDate (). so far could not find any documentation for this explanation.

Thanks,

Piranha
Chief II

No, there is no documentation... only this:

https://github.com/STMicroelectronics/STM32CubeH7/blob/79196b09acfb720589f58e93ccf956401b18a191/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rtc.c#L1032

And RM0433 section 46.3.9:

To ensure consistency between the 3 values, reading either RTC_SSR or RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read.

And of course idiot made HAL is such a "high-level" library that you have to deal with low-level specifics to use it...