[Test Results] The RTC clock of the TOOL has always been manually calibrated via the host computer. This time, an experiment was conducted without any calibration for half a year to observe the results. The test started on September 29 last year.As of April 5 this year, it was fast by 13 minutes.[Causes of Error] The crystal oscillator is sensitive to temperature. Below is the typical impact of temperature on the crystal oscillator: STM32 supports an internal low-speed clock (LSI) or an external low-speed clock (LSE). If using external, a 32768Hz crystal must be connected. A typical error of about 50 seconds per month.[Calibration Methods]Taking the external RTC DS3231 as an example, the accuracy is:Accuracy ±2ppm from 0°C to +40°C —- The maximum error calculated over a month of 30 days is 2*10^-6 * 24 * 60 * 60 * 30 = 5.184 seconds.Accuracy ±3.5ppm from -40°C to +85°C —- The maximum error calculated over a month of 30 days is 3.5*10^-6 * 24 * 60 * 60 * 30 = 9.072 seconds. Using STM32’s internal RTC is not feasible; if the daytime temperature is unstable, the error for that day can be about 1-2 seconds, mainly because the crystal oscillator is not temperature compensated.
ST provides some solutions, but they are not practical:
Method 1: Smooth digital calibration
This method is cumbersome. The currently provided example requires users to use a high-precision signal clock, accurate to several ppm, to send this signal to the board for calibration. Then, an oscilloscope measures the actual output to determine whether to use this calibration value.Method 2: RTC clock synchronization The official examples are not very valuable, and they involve high-precision HSE.Method 3: Use a 50Hz/60Hz high-precision reference clock for assistanceThis practicality is also somewhat lacking.Currently recommended solutions:(1) Use an external temperature-compensated crystal oscillator, but the price is slightly higher, around 10 yuan:(2) Use RTC chips with built-in temperature compensation.[RTC Calibration Software Package]
https://www.st.com/en/embedded-software/x-cube-rtc.html
Leave a Comment
Your email address will not be published. Required fields are marked *