The RTC Time Seconds Register only save the seconds, how to ensure the accuracy of the millisecond?
Thanks!
We need to differentiate 'accuracy' and 'precision'. For precision: If you stop the RTC, you can write the prescale-register (TPR) by multiplying your 'milliseconds' by 32768/1000. With that simple extension your driver can easily read and write 'millisecond' precision.
As for accuracy, the default 32,768 divider CAN have the small adjustments mentioned (this would, however, negate the ability to convert TPR to ms with the simple 1000/32768 factor), and with that you could compensate the typical temperature-curve of watch-crystals, but ONLY if you are 'awake', at least periodically, to measure temperature and adjust the compensation appropriately. Another way to get 12ppm accuracy (~1sec/day) is to use an external part that already does this real-time temperature-compensation: SiTime: SIT1552AC-JE-DCC-32.768D. Takes a little more battery, but insures +/-10ppm 0-70C (extended temp versions available -40+85C, holds +/-13ppm).
Hi,
RTC has contain the compensation logic which provides an accurate and wide compensation range and can correct errors as high as 3906 ppm and as low as 0.12 ppm.
So I'd like to suggest you to learn the more information about the compensation operation from the K64' reference manual.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------