cancel
Showing results for 
Search instead for 
Did you mean: 

RTC time drift issue

Sayantan0608
Associate II

Hello, I have come across an issue with the RTC in my project.

In my project I am using the following:-

  1. MCU:- STM32H743IIT6
  2. IDE version:- 1.19.0
  3. SDK version:- 1.12.1

I will discuss the issue here, I wrote a program that uses the RTC and print the current time and I tested it straight for 72 hours, what I noticed since the second day that there was a constant drift in time, which kept on changing, and on the last day I observed that there was a total drift of 13 seconds since I started the test. This drift is really concerning for the product that we have made, and that product is already out for field operations. This issue was earlier reported and a ticket was created on ST's online support forum the ticket id is 00255958. They replied to the issue that was reported and asked us to perform the test that I described above, and report this issue over here at ST Community.

Please do reply to this message if anyone has any solution for this issue. It is a matter of urgency


I am attaching my code, the schematics, and also providing the link for the RTC crystal that has been used.
Link for the RTC crystal:- https://www.digikey.in/en/products/detail/abracon-llc/ABS05-32-768KHZ-9-T/3508064?s=N4IgTCBcDaIIICEDKAGArAWgMxgHQHYA2ADgGkAJALQwE4MAVEAXQF8g 
  

Thanks

11 REPLIES 11
######
Senior II

Hello,

I'm no expert (at all) on this, but...

I remember reading something on this forum about using a different drive strength for this line to get reliable operation

__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

 Do you have a choice of using an option of Medium or High?

Best of luck with your issue.

 

Gyessine
ST Employee

Hello @Sayantan0608 
13 seconds drift in 72 hours gives ~50ppm which can be calibrated 
The RTC frequency in the STM32H743 can be digital calibrated with a resolution of about 0.954 ppm with a
range from -487.1 ppm to +488.5 ppm
Did you try to calibrate the RTC clock? you can refer to this article 
Also, I suspect it's a hardware related issue, I suggest you consult this application note. It provides some guidelines about oscillator design. like section 4. Guidelines to select a suitable crystal and external components
Also, @######   note might be helpful.
please try these tips and provide your feedback
waiting for your reply
BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

jiangfan
ST Employee

the ABS RTC crystal specification is +-20ppm:

Frequency Tolerance
±20ppm

1 day is 86400seconds. 86400*20ppm = 1.73. or say 1.73seconds per day. 1.73*3 = 5.19 or say 5.19seconds drift for 72 hours, but you saw 13seconds for 72 hours. so, it shows LSE/RTC is out of 20ppm specification.

if LSE/RTC accuracy is very important, you need +-20ppm or even +-15ppm, you need to fine tune load capacitance and output LSE clock at MCO and measure with frequency meter to ensure the accuracy.

LSE drive mode may also impact oscillation stability and accuracy. as I remember MediumHigh or MediumLow drive mode seems better for STM32H7 LSE stability.

mbarg.1
Lead

Don't try to get a result beyond possible.

If you need a stable time, you need to use some connection to UTC - ethernet (NTP) or gps.

You can work on crystal oscillator but IT IS NOT designed with long term second stability in mind.

A TCXO could help BUT in one week or ine month you are out of sync any way.

You can trim but temp drift is real - no way to predict temp in long term.

Hello @Gyessine 

So, I came across some findings yesterday, thought I should discuss it with you. I referred to the article that you suggested for the RTC calibration. Turns out the average frequency of the signal generated on the RTC_OUT_CALIB GPIO was 464 Hz instead of ~512 Hz, and that gives the actual frequency of the RTC clock to be 29.67 KHz instead of the mentioned ~32.7 KHz, I mean it's insane. Also, I calculated the PPM error using the formula provided in the article it came out to be -93750

If you find any insights from my findings, please do reply back, that would be of great help. 

Have a great day ahead.

Sayantan 

It is clear you are using wrong oscillator - LSI (32kHz, low stability) instead of LSE(32.768, crystal).

Have a look to "STM32H7 RTC accuracy with 32.768 kHz LSE quartz in VDD mode and VBAT mode" discussion.

Please mark thia as a asolution, if ou agree.

 

No, I am not using the LSI I am using the LSE only, I have checked twice.

the actual frequency of the RTC clock to be 29.67 KHz

observed that there was a total drift of 13 seconds (in 72 hours?)

such information from you does not match