Load compensation register
Compensation event
Load compensation register
Compensation event
Load compensation register
Compensation event
Hour event
Hours
Seconds
Hours
Seconds
Compensation
enable
3
4
58
59
0
1
2
58
59
0
1
2
3
4
59
0
1
swcs045-026
SWCS045B
– SEPTEMBER 2010 – REVISED JUNE 2011
Figure 4. RTC Compensation Scheduling
To compensate for inaccuracy in the 32-kHz oscillator, it is possible to balance this drift. Software must calibrate
the oscillator frequency, calculate the drift compensation versus a 1-hour period, and then load the compensation
registers with the drift compensation value. If the AUTO_COMP bit in RTC_CTRL_REG is enabled, the
RTC_COMP_MSB_REG/RTC_COMP_LSB_REG value (in 2's complement) is added to the RTC 32-kHz counter
at each hour and 1 second. When RTC_COMP_MSB_REG/RTC_COMP_LSB_REG is added to the RTC 32-kHz
counter, the duration of the current second becomes (32768
– RTC_COMP_M/LSB_REG) / 32768 seconds;
therefore, it is possible to compensate the RTC with a 1/32768-s time unit accuracy by hour.
NOTE
The compensation is taken into account once written in the registers. When the TWL6030
device enters backup mode, the host IC must write the previously correct compensation
value.
Interrupts
Table 4. RTC Interrupts
INTERRUPT
DESCRIPTION
RTC_ALARM
RTC alarm event: Occurs at programmed date and time.
RTC periodic event: Occurs at programmed period of time (each
RTC_PERIOD
second or minute, etc.).
The RTC can generate two types of interrupts:
Timer interrupt (RTC_PERIOD) can be generated periodically; that is, each second, minute, hour, or day
(RTC_INTERRUPTS_REG EVERY[1:0] bits). This interrupt is enabled by the IT_TIMER bit of the
RTC_INTERRUPTS_REG
interrupts
register.
It
is
a
negative
edge-sensitive
interrupt.
The
RTC_STATUS_REG[5:2] bits (1D_EVENT, 1H_EVENT, 1M_EVENT, 1S_EVENT) are updated only at each
new interrupt. They present which type of events occur.
Alarm interrupt (RTC_ALARM) can be generated when the time set into the TC alarm registers
(ALARM_SECONDS_REG,
ALARM_MINUTES_REG,
ALARM_HOURS_REG,
ALARM_DAYS_REG,
ALARM_MONTHS_REG, ALARM_YEARS_REG) is the same as in the TC registers (SECONDS_REG,
MINUTES_REG, HOURS_REG, DAYS_REG, MONTHS_REG, YEAR_REG, WEEKS_REG). This interrupt is
then generated if the IT_ALARM bit of the RTC_INTERRUPTS_REG interrupts register is set. This interrupt is
34
Copyright
2010–2011, Texas Instruments Incorporated