2021-08-31 12:05 AM
Hi, I am using STM32L452 Controller and I would like to use LSI for RTC which is not an accurate clock source.
I referenced the following manual and adjusted the pre-scaler as
2.8 RTC prescaler adjustment with LSI measurements - page 23
But still, I see the lag in one device and lead in one device.
Is there a process to calibrate it?
2021-08-31 12:47 AM
No clock is perfect. What sort of accuracy are you expecting and what are you seeing instead?
Calibration is only going to be as good as the source you're using to calibrate. What are you using? HSE should be good, HSI not so much.
2021-08-31 12:52 AM
I am using LSI Clock.
I am seeing around a 5-minute lead in one device and around 4 minute lag in one device.
2021-08-31 01:06 AM
> I am seeing around a 5-minute lead in one device and around 4 minute lag in one device.
In what time?
LSI is an inherently low precision and also low stability RC oscillator. The datasheet gives a 3% error at fixed voltage and temperature, that's 5 minutes error in roughly 3 hours.
JW
2021-08-31 01:19 AM
> I am using LSI Clock.
I understand you are using the LSI clock for the RTC. But how are you calibrating it? An oscilloscope? Another onboard timer?
2021-08-31 02:21 AM
I am seeing around a 5-minute lead in one device and around 4 minute lag in one device. per day
2021-08-31 02:23 AM
I am not calibrating it as of now. I am just adjusting the Prescaler value as explained in the above document in section 2.8
2.8 RTC prescaler adjustment with LSI measurements - page 23
I need ways to calibrate it?
2021-08-31 03:45 AM
As I've said, according to datasheet, you can expect worst case 5 minute deviation in roughly 3 hours.
The LSI oscillator is inherently unstable, you cannot expect more precision from it, whatever your adjustment/calibration process is.
JW
2021-08-31 04:10 AM
OK Thank you
2021-08-31 10:07 AM
Thought this meant you were calibrating it:
> I referenced the following manual and adjusted the pre-scaler
To calibrate, put out the RTC_CALIB signal on a line somewhere and use an oscilloscope to measure the frequency. Adjust the prescaler such that the frequency is corrected. This needs to be done on every chip.
You can also use an onboard timer if you're using an accurate clock source such as HSE.
What JW says is true, but you can calibrate out much of the inaccuracy if your temperature is stable.