cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 RTC Accuracy/Calibration Methods?

Mauricio
Associate II

Hello Everyone, I am using the STM32F777 and utilizing its RTC and external 32.768 crystal(LSE).

Currently I am having a drift of 79s in 76 hours. it is a little bit less than a second per hour. It is not that bad but I would like to have a better result like 10h of drift in a year would be okay. And now I have ~150h per year.

I am currently using a Crystal with tolerance of 20ppm. they say that is 20s of error per 12days. But I am not sure about this calculation, anyone knows how to calculate that?

Do you guys think it is achievable? How do I calibrate this CLK? I didn't any sample code or CubeIDE ready calibration method.

Please any help would be very much appreciate.

Cheers,

MM

1 REPLY 1
TDK
Guru

20ppm (20/1000000) is a ratio, so the error over 12 days is going to be 12 days * (20/1000000) = 20.7sec. Just math.

Calibration is done in HAL_RTCEx_SetSmoothCalib. Doesn't seem like it's used in the Cube examples, but the documentation looks pretty simple.

https://github.com/STMicroelectronics/STM32CubeF7/blob/79acbf8ec060d3ec751f2eaba6ee050269995357/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rtc_ex.c#L1394

If you feel a post has answered your question, please click "Accept as Solution".