RTC_C Operation
809
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Real-Time Clock (RTC_C)
20.2.7 Real-Time Clock Calibration for Crystal Offset Error
The RTC_C module can be calibrated for crystal manufacturing tolerance or offset error for higher time
keeping accuracy. The crystal frequency error of up to ±240ppm can be calibrated smoothly over a period
of 60 seconds. RTCOCAL_L register is used to adjust the frequency. The calibration value is written into
RTCOCAL_L register and each LSB in this register represent approximately ±1ppm correction based on
RTCOCALS bit in RTCOCAL_H register. When RTCOCALS bit is set (up calibration), each LSB in
RTCOCAL_L rep1ppm adjustment and when RTCOCALS is cleared (down calibration), each LSB
in RTCOCAL_L represent -1ppm adjustment to frequency. Both RTCOCAL_L and RTCOCAL_H registers
are protected and requires RTC to be unlocked before writing into these registers.
20.2.7.1 Calibration Frequency
To calibrate the frequency, the RTCCLK output signal is available at a pin. RTCCALFx bits in RTCCTL3
register can be used to select the frequency rate of the output signal. When RTCCALFx = 00, no signal is
output on RTCCLK pin. The other settings of RTCCALFx select one the three frequencies 512Hz, 256Hz
or 1Hz. RTCCLK can be measured and the result of this measurement can be applied to the RTCOCALS
and RTCOCALx bits to effectively reduce the initial offset of the clock.
20.2.7.1.1 Calibration Mechanism
RTCOCAL_L is an 8 bit register. Software can write up to value of 256ppm into this register but the
maximum frequency error that can be corrected is only 240ppm. Software should take care of writing legal
values into this register. Read from RTCOCAL always returns the value that was written by software.
Real-time clock offset error calibration is inactive when RTC is not enabled (RTCHOLD = 0) or when
RTCOCALx bits are zero. RTCOCAL should only be written when RTCHOLD=1. Writing RTCOCAL resets
temperature compensation to zero.
In RTC, the offset error calibration takes place over a period of 60 seconds. To achieve approximately
±1ppm correction, the 16kHz clock (Q0 output of RT0PS) is adjusted to add or subtract 1 clock pulse. For
+1ppm correction, 1 clock pulse is added to 16kHz clock and for -1ppm correction, 1 clock pulse is
subtracted from 16kHz clock. This correction happens once every quarter second until the programmed
ppm error is compensated.
f
BCLK,meas
< 32768Hz => RTCOCALS = 1, RTCOCALx = Round (60 x 16384 x (1-f
BCLK,meas
/32768))
f
BCLK,meas
≥
32768Hz => RTCOCALS = 0, RTCOCALx = Round (60 x 16384 x (1-f
BCLK,meas
/32768))
As an example for up calibration, when the measured frequency is 511.9658Hz against the reference
frequency of 512Hz, the frequency error is approximately 67ppm low. In order to increase the frequency
by 67ppm, RTCOCALS should be set, and RTCOCALx should be set to Round (60 x 16384 x (1-
511.9658x64/32768)) = 66.
As an example for down calibration, when the measured frequency is 512.0241Hz against the reference
frequency of 512Hz, the frequency error is approximately 47ppm high. In order to decrease the frequency
by 47ppm, RTCOCALS should be cleared, and RTCOCALx should be set to Round (60 x 16384 x (1-
512.0241x64/32768)) = 46.
All three possible output frequencies 512Hz, 256Hz, and 1Hz at RTCCLK pin are affected by calibration
settings. RT0PS interrupt triggered by RT0PS-Q0 (RT0IPx = 000) is based on un-calibrated clock while
RT0PS interrupt triggered by RT0PS – Q1 to Q7 (RT0IPx
≠
000) is based on calibrated clock. RT1PS
interrupt (RT1PSIFG) and RTC counter interrupt (RTCTEVIFG) are also based on calibrated clock.
20.2.8 Real-Time Clock Compensation for Crystal Temperature Drift
The frequency output of the crystal varies considerably due to drift in temperature. It would be necessary
to compensate the real-time clock for this temperature drift for higher time keeping accuracy from standard
crystals. A hybrid software and hardware approach can be followed to achieve temperature compensation
for RTC.