Skip to main content
StephanMair
Associate III
June 28, 2021
Solved

RTC inaccuracy induced by internal clock source?

I'm using the STM32L431xx mcu.

The current hardware configuration of our design has no external clock source (crystal), so we are using the internal one. And there's a new functionality which demands second-accurate real time clock, over a period of 3 or so months.

According to our previous experience, which could be wrong, there will be roughly 1 second error for every 3 days if we leave the RTC running. This clearly is unacceptable.

I'm trying to find out whether there's a way to compensate/eliminate/offset this error? Without using external clock source of course.

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
June 29, 2021

What do you mean by "internal clock"?

LSI (and MSI/HSI) error you look up in the datasheet, but it's generally in ones of percent, i.e. about one second in a minute.

LSE with crystal can achieve around 10ppm, with *careful* design, that's roughly one second in a day. You can calibrate it to 1ppm, i.e. 1 second in 10 days, but it will drift with temperature.

JW

4 replies

waclawek.jan
Super User
June 28, 2021

> And there's a new functionality which demands second-accurate real time clock, over a period of 3 or so months.

3 months, that's roughly 8 million seconds, so you are talking about roughly 0.12 ppm precision. That's not in the domain of common crystal-driven clocks, you are about to enter the realm of high precision TXCO; or maybe even beyond, to atomic clocks.

Be prepared your budget to explode.

JW

StephanMair
Associate III
June 29, 2021

:face_with_tears_of_joy:

Sorry I haven't done my math.

So what are you sayin? That the internal clock is capable of this task?

No I'm not talking about atomic-clock accuracy, I'm talking about roughly the same as your phone or your smart watch, I get it that both devices gets to sync with the internet, but that's a different story and not really something I'm willing to explore.

So I think the question boils down to if the RTC, powered by the internal clock source, can hold a candle to a smartwatch without internet connection (or a CASIO dumb watch for that matter) in terms of accuracy.

waclawek.jan
waclawek.janBest answer
Super User
June 29, 2021

What do you mean by "internal clock"?

LSI (and MSI/HSI) error you look up in the datasheet, but it's generally in ones of percent, i.e. about one second in a minute.

LSE with crystal can achieve around 10ppm, with *careful* design, that's roughly one second in a day. You can calibrate it to 1ppm, i.e. 1 second in 10 days, but it will drift with temperature.

JW

StephanMair
Associate III
June 29, 2021

Hi JW, thank you for your reply as always.

I've looked up the specs, it's a whopping 5%, so the inaccuracy will be a matter of minutes after just one day.

We have lowered our expectation and stopped counting on it to provide a meaningful time reference.