2018-04-16 07:09 AM
Hi everyone,
I have been trying to set 1ppm RTC clock for two days.I have read the datasheet and manual. They are recommended to use 2 timers and an external oscillator. Also, with using HAL_RTCEx_SetSmoothCalib function, says that we can calibrate it easily. I set the RTC routed output as calibration 512Hz, but the frequency of it is 511.96Hz. After that, I read a manual that is
for STM32F1s. As it says, I have calculated the ppm error.512-511.96=0.04Hz => 0.04/511.96=7.81e-5 => ppm=78.13, the manual recommends the using 83 for the calibration value.
And then called the smooth calibration function this value. Thus;
HAL_RTCEx_SetSmoothCalib(&hrtc, RTC_SMOOTHCALIB_PERIOD_32SEC, RTC_SMOOTHCALIB_PLUSPULSES_RESET, 83);
However, although the calibration value has been changed, the routed value is still the 511.96Hz. Why doesn't it change?
#stm32f4-rtc2018-04-16 07:23 AM
This depends on the method used to measure the frequency of the 512Hz output. As the calibration inserts/removes pulses within a 32-second cycle, you really should use a method which accumulates measurement during those 32 seconds.
If your measurement method measures duration of one pulse, in the 512Hz output, most of the pulses are still 1/512 seconds long, and here and there there are shorter, 1/520 second long pulses, compensating in the long run the total frequency error.
JW