RTC_C Operation
810
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Real-Time Clock (RTC_C)
The software can make use of an (on-chip) temperature sensor to measure the temperature at desired
intervals (for example, once every few seconds or minutes). The temperature sensor parameters are
calibrated at production and the values are stored in the device descriptor (TLV). Using the temperature
sensor parameters and the measured temperature, software can do parabolic calculations to find out the
corresponding frequency error in ppm.
This frequency error can be written into RTCTCMP_L register for temperature compensation.
RTCTCMP_L is an 8 bit register that can cover the frequency error up to ±240ppm. Each LSB in this
register represent ±1ppm based on RTCTCMPS bit in RTCTCMP_H register. When RTCTCMPS bit is set,
each LSB in RTCTCMP rep1ppm adjustment (up calibration) and when RTCTCMPS is cleared,
each LSB in RTCTCMP represent -1ppm adjustment (down calibration). RTCTCMP register is not
protected and can be written any time without having to unlock RTC.
20.2.8.1 Temperature Compensation
RTCTCMP_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 including the crystal offset error is only 240ppm. Real-
time clock temperature compensation is inactive when RTC is not enabled (RTCHOLD = 0) or when
RTCTCMPx bits are zero
When the temperature compensation value is written into RTCTCMP_L, it is added with offset error
calibration value and the resulting value is taken into account from next calibration cycle onwards. The
ongoing calibration cycle is not affected by writes into RTCTCMP register. The maximum frequency error
that can be corrected to account for both offset error and temperature variation is ±240ppm. This means
the sign addition of offset error value and temperature compensation value should not exceed maximum
of ±240ppm otherwise the excess value above ±240ppm is ignored by hardware. Reading from
RTCTCMP register at any time returns the cumulative value which is the signed addition of RTCOCALx
and RTCTCMPx values. (Writing RTCOCAL reset the temperature compensation value to zero.)
For example, when RTCOCAL value is +150ppm and the value written into RTCTCMP is +200ppm the
effective value taken in for next calibration cycle is +240ppm. Software is expected to do temperature
measurement at certain regularity, calculate the frequency error and write into RTCTCMP register to not to
exceed the max limit of ±240ppm.
Changing the sign-bit by writing to RTCTCMP_H is effective only after writing RTCTCMP_L as well. Thus
TI recommends writing the sign-bit together with the compensation value as a 16-bit value into
RTCTCMP.
20.2.8.2 Writing to RTCTCMP Register
As the system clock could be asynchronous to the RTC clock source, RTCTCRDY bit in RTCTCMP_H
register should be considered for reliable writing into RTCTCMP register. RTCTCRDY is a read only bit
that gets set when the hardware is ready to take in the new temperature compensation value. Write to
RTCTCMP should be avoided when RTCTCRDY bit is reset. Writes into RTCTCMP register when
RTCTCRDY is reset are ignored.
RTCTCOK is a status bit that indicates if the write to RTCTCMP register is successful or not. RTCTCOK
is set if the write to RTCTCMP is successful and reset if the write is unsuccessful. The status remains
same until affected by the next write to RTCTCMP register. If the write to RTCTCMP is unsuccessful, then
application must write into RTCTCMP again when RTCTCRDY is set.
. shows the scheme for real-time clock offset error calibration and temperature compensation.