cancel
Showing results for 
Search instead for 
Did you mean: 

How to calibrate ( RTC )LSE Crystal by temperature ?

oziesin
Associate III

I ' ve been working on a device that able to use industrial area. I must be sure that rtc clock is accurate because this device need to use RTC too much. When i researched , i did not find any code example about rtc calibration by temperature. Any suggestion, would be appriciate.

5 REPLIES 5
Peter BENSCH
ST Employee

A correction of the LSE is only possible with the calibration functions of the RTC (see e.g. reference manual: RTC smooth digital calibration, availability depends on the derivative).

A temperature-dependent correction requires knowledge of both the exact current temperature and the temperature depending curve shape of the crystal frequency including the load capacitors, etc., which is why no general recommendation can be given.

Good luck!

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order 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.

Generally, you would need to

  • have a method to measure temperature of the crystal, e.g. using a thermistor placed so that thermal resistance between it and crystal is way less than thermal resistance of any thermal path which would heat or cool the crystal (this is the "know exact temperature" part mentioned by Peter above)
  • have a good characterisation of the temperature dependence of crystal frequency, either from manufacturer, or by characterizing it yourself. In the latter case, you could either perform the characterization once and have faith in that production pieces don't depart from that curve too much; or perform individual factory calibration
  • characterize impact of aging, perform artificial aging if needed
  • write the program so that it periodically measures crystal temperature and performs corrections - whether by calculating and performing time shifts, or by using the "digital calibration" as Peter suggested

Or, you can simply buy a TXCO or an external RTC with integrated temperature-compensated crystal, where all this has been already done by the TXCO manufacturer.

JW

oziesin
Associate III

Thank you all, but still i confused. I have a few questions.

  • am I must be read RTC calibration output (1Hz) via input capture ?
  • How can i implement temperature curve into calibration ?

I reviewed https://www.st.com/content/my_st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-rtc.license=1591104676826.product=X-CUBE-RTC.version=3.0.0.html

I am wondering if temperature was changed, the RTC output(1Hz) would be change is not it ?

Why am i need to the tempereature curve ?

You could use synchronization with a 1Hz signal (but you don't have to) if you have a very precise reference signal, e.g. the 1PPS of a GPS receiver.

If you want to correct the crystal according to the current temperature, you first need the temperature curve of the crystal, which heavily depends on the manufacture (quartz cut). Usually you can get it from the manufacturer of the crystal, or you have to characterize the curve, as Jan mentioned above. For more information on the temperature curve of crystals, you can take a look at the AN2971, for example, which deals with a different method of compensation, but shows the principle of the temperature curve well.

Then you have to know the exact temperature of the crystal, also depending on the requirements.

Then you could write a program that e.g. does a running smooth calibration and thus fades out or adds individual pulses of the LSE frequency.

Regards

/Peter

In order 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.
oziesin
Associate III

I cannot figure out PPS stuff , do i calibrate by temperature without reading 1hz signal from RTC out ? I dont use GPS in this project