SLVSE83B December 2020 – September 2023 TPS6593-Q1
PRODUCTION DATA
The RTC_COMP_MSB_REG and RTC_COMP_LSB_REG registers are used to compensate for any inaccuracy of the 32-kHz clock output from the 32-kHz crystal oscillator. To compensate for any inaccuracy, MCU must perform an external calibration of the oscillator frequency by calculating the needed drift compensation compared to one hour time-period, and load the compensation registers with the drift compensation value.
The compensation mechanism is enabled by the AUTO_COMP_EN bit in the RTC_CTRL_REG register. The compensation process happens after the first second of each hour. The time between second 1 and second 2 (T_ADJ) is adjusted based on the settings of the two RTC_COMP_MSB_REG and RTC_COMP_LSB_REG registers. These two registers form a 16-bit, 2 s complement value COMP_REG (from –32767 to 32767) that is subtracted from the 32-kHz counter as per the following formula to adjust the length of T_ADJ: (32768 - COMP_REG) / 32768. Therefore, this compensation mechanism can adjust the compensation with a 1/32768-second time-unit accuracy per hour and up to 1 second per hour.
Software must ensure that these registers are updated before each compensation process (there is no hardware protection). For example, software can load the compensation value into these registers after each hour event, during second 0 to second 1, just before the compensation period, happening from second 1 to second 2.
If the SET_32_COUNTER bit in the RTC_CTRL_REG register is set to '1', the internal 32-kHz counter is pre-loaded with the content of the RTC_COMP_MSB_REG and RTC_COMP_LSB_REG registers. This preloading of the internal 32-kHz counter can only be done when the RTC is stopped.
Figure 8-14 shows the RTC compensation scheduling.