cancel
Showing results for 
Search instead for 
Did you mean: 

The caliberation for RTC is one of those "nice to have" feature, not exactly something you should count on right? Should you use it and hope for a meaningful result?

StephanMair
Senior

I'm using STM32L431xx series mcus and as with most STM32 mcus, it has an RTC feature with calendar. The RTC has a calibration function by which you can fine-tune the counting scheme of the RTC and improve upon the accuracy of your clock source.

This works well in theory, but in reality, take into consideration that I'm using an internal clock source (LSI), I wonder how and if this should be put to use.

By that I mean if there is a common characteristic for the LSI, as in does it have a consistent tendency to tick slower or quicker over time, and if this consistency can be observed throughout even different batches.

The official tech-docs puts the accuracy of LSI at ±5%, at the first look it implies it could either go faster or slower than it should, thus rendering the calibration really difficult, since:

  • There could be no consistency within the same batch
  • If the development chip is different than the production chip, the calibration is rendered useless
  • Even if consistency is not a major issue for the same batch, calibrations still need to be done for every single different batch.

With these background information provided and concerns listed, my question is:

Should you use the calibration feature in hoping to achieve higher accuracy, given that LSI will be powering the RTC, and LSI is notoriously inaccurate to begin with?

1 ACCEPTED SOLUTION

Accepted Solutions
SBEN .2
Senior II

Hello @StephanMair​ ,

As you've already deduced, LSI wouldn't be a great clock source for RTC if accuracy is paramount in your design. To have the best accuracy it is recommended to use LSE + calibration against the device's operational temperature range.

To answer your question, calibrating and LSI should improve the accuracy, but it wouldn't compare to calibrated LSE.

Please refer to this application note How to calibrate STM32L4 Series microcontrollers internal RC oscillator. You should be able to at least empirically check if the accuracy figures would be enough for your application.

Best regards,

@SBEN .2​ 

View solution in original post

6 REPLIES 6
SBEN .2
Senior II

Hello @StephanMair​ ,

As you've already deduced, LSI wouldn't be a great clock source for RTC if accuracy is paramount in your design. To have the best accuracy it is recommended to use LSE + calibration against the device's operational temperature range.

To answer your question, calibrating and LSI should improve the accuracy, but it wouldn't compare to calibrated LSE.

Please refer to this application note How to calibrate STM32L4 Series microcontrollers internal RC oscillator. You should be able to at least empirically check if the accuracy figures would be enough for your application.

Best regards,

@SBEN .2​ 

Correct me if I'm wrong, but RTC with LSI clock source is not able to work as "real time" (due low accuracy and stability of LSI frequency). Main use case RTC+LSI combination is in low power regimes where RTC is able to wake up MCU from deep sleep modes.

Hello @Michal Dudka​ 

In low power modes it is possible to clock the RTC using either LSE and LSI. LSE would also continue to work in shutdown mode. It would also consume a smidge more power than LSI (depends on RCC_LSEDRIVE) and would require additional parts (XATL and two caps).

Best regards,

@SBEN .2​ 

Yes. It is posible to use LSI clocked RTC. But not as "real time clock/calendar". For example to periodic wakeup where precision time is not important (for example with deviation in order of %). But if someone want to use RTC in original meaning (to keeping time) then must use LSE or other XTAL clock source, or some kind synchronisation. Datasheet does not contain informations about LSI stability (probably because it's so inaccurate that no one even thought to use it

for "precision" work - which is OK).

Hi thank you for your reply, much appreciated.

We are not planning on use it for "precision" work, just a rough estimate of how many time had passed.

Thank you. This is the best answer.