8 Real-TiMe ClOCK (RTC)
8-4
Seiko epson Corporation
S1C17624/604/622/602/621 TeChniCal Manual
RTC Control
8.3
Operating Clock Control
8.3.1
The RTC is clocked by the 32.768-kHz (typ.) OSC1 clock. To start running the RTC, set RTCCE/RTC_CC register
to 1 to supply the OSC1 clock from the CLG to the RTC.
Setting RTCCE to 1 enables the OSC1 oscillator circuit to activate and to supply the OSC1 clock to the RTC re-
gardless of the OSC1 oscillator setting in the CLG (even if OSC1EN/OSC_CTL register is set to 0 (OSC1 oscilla-
tion off)). Furthermore, the OSC1 clock will be supplied from the OSC1 oscillator circuit to run the RTC even in
SLEEP mode if RTCCE is set to 1.
For more information on the OSC1 oscillator circuit, see the “Clock Generator (CLG)” chapter.
note: After an initial reset, RTCCE is set to 0 and the RTC idles. The OSC1 oscillator circuit is also idle.
Therefore, resetting the IC suspends the RTC operation for the period shown below.
RTC idle time = [#REST = low period] +
[IOSC oscillation stabilization time] +
[Time until OSC1 is started] +
[OSC1 oscillation stabilization time] +
[Time until RTC is restarted]
RTC initial Sequence
8.3.2
Immediately after power-on, the contents of RTC registers are indeterminate. After powering on, follow the proce-
dure below to let the RTC start ticking the time. Later sections detail the contents of each control.
1. Power-on
2. System initialization processing
Initialize the system. If any peripheral module other than RTC uses the OSC1 clock, turn the OSC1 oscillator
circuit on using the CLG register.
3. Software reset
Write 1 to RTCRST/RTC_CNTL0 register and then write 0 to reset the RTC.
4. Confirming accessibility status of the RTC
See Section 8.3.5, “Counter Hold and Busy Flag.”
5. Disabling the divider
Write 1 to RTCSTP/RTC_CNTL0 register to stop the divider in the RTC module.
6. Setting the RTC interrupt
Set the RTC_INTMODE register.
Be sure to set RTCIMD to 1 (level sense).
7. Setting the date and time
Set the RTC_SEC, RTC_MIN, RTC_HOUR, RTC_DAY, RTC_MONTH, RTC_YEAR, and RTC_WEEK regis-
ters. Then, write 0 to RTCHLD/RTC_CNTL1 register to release the 1-second, 10-second, 1-minute, 10-minute,
1-hour, 10-hour, 1-day, 10-day, 1-month, 10-month, 1-year, 10-year, and days of week counters from hold sta-
tus.
8. Enabling the clock supply
Write 1 to RTCCE/RTC_CC register to start supplying the OSC1 clock from the CLG to the RTC.
9. Starting the divider
Write 0 to RTCSTP/RTC_CNTL0 register to run the divider in the RTC module.