Skip to main content
Ukazu
Associate III
February 18, 2020
Solved

about RTC calibration! by use for LSI clk. (STM32F091V)

  • February 18, 2020
  • 4 replies
  • 1064 views

I use STM32F091V

I use LSI for RTC clock.

I know that LSI is inaccurate.

I set the RTC interrupt to 1 second.

However, the interrupt interval was 860ms.

Can anyone tell me how to calibrate the RTC?

I am happy with the sample source code.

This topic has been closed for replies.
Best answer by waclawek.jan

LSI is very imprecise an not very stable, see datasheet. You can somewhat compensate for this by setting different values to the RTC prescaler, but it's not suitable for maintaining real time. Use LSE with a crystal.

JW

4 replies

waclawek.jan
waclawek.janBest answer
Super User
February 18, 2020

LSI is very imprecise an not very stable, see datasheet. You can somewhat compensate for this by setting different values to the RTC prescaler, but it's not suitable for maintaining real time. Use LSE with a crystal.

JW

Ukazu
UkazuAuthor
Associate III
February 26, 2020

Hi jan!!

Thank you for your support.

In my system, the main clock is a crystal, so I will use this crystal to correct the RTC interrupt time.

Add the correction value to the RTC count value.

waclawek.jan
Super User
February 26, 2020

Alternatively, you can use directly the HSE output (divided by 32) as RTC input; of course you have then adjust the RTC prescaler values according to the actual crystal frequency.

0690X00000DXJfHQAX.png

JW

waclawek.jan
Super User
February 26, 2020

If you chose the LSI as RTC input, you can compare it to the system clock using TIM14, see TIM14_OR.

JW