2023-04-12 02:23 AM
I am currently working on an RTOS application that includes RTC, and have observed that there is a clock drift of approx. 25 to 32 seconds after a 24-hour measurement cycle. Additionally, the drift seems to be not linear.
I've measured the RTC frequency and it was around 32.78KHz.
I would appreciate if anyone could provide any suggestions on how to improve the RTC performance.
Solved! Go to Solution.
2023-04-12 06:38 AM
Which STM32?
What hardware?
What is the RTC clock source?
Does the "drift" increase with number of resets?
JW
2023-04-12 06:38 AM
Which STM32?
What hardware?
What is the RTC clock source?
Does the "drift" increase with number of resets?
JW
2023-04-13 02:24 AM
I am using Discovery kit with STM32L4R9AI MCU and the RTC clock source is LSE 32.768KHZ.
I have to investigate whether the drift increases with reset, but the drift also appears without reset.
2023-04-13 04:27 AM
This is way too much error for LSE, and I don't assume the Disco would have problematic crystal/PCB layout.
Read out and check/post content of RCC_BDCR register, and possibly content of RTC registers too.
JW
2023-04-13 04:50 AM
I noticed a significant increase in the drift when resetting the board many times. Do you think it would be advisable for me to check the RCC_BDCR?
2023-04-13 05:32 AM
> I noticed a significant increase in the drift when resetting the board many times.
What is "significant"? Is it in average about half a second per reset? If yes, resort to the link I've posted above.
JW
2023-04-13 03:18 PM
The issue has been resolved in HAL_RTC_Init() looses time · Issue #24 · STMicroelectronics/STM32CubeH7 · GitHub as the number of times I reset the MCU had an impact on the drift.
Thanks for indicating the main cause of the problem.