cancel
Showing results for 
Search instead for 
Did you mean: 

RTC drift

KIbra.3
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Which STM32?

What hardware?

What is the RTC clock source?

Does the "drift" increase with number of resets?

JW

View solution in original post

6 REPLIES 6

Which STM32?

What hardware?

What is the RTC clock source?

Does the "drift" increase with number of resets?

JW

KIbra.3
Associate II

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.

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

KIbra.3
Associate II

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?

> 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

KIbra.3
Associate II

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.