10 REAL-TIME CLOCK (RTCA)
10-2
Seiko Epson Corporation
S1C31D50/D51 TECHNICAL MANUAL
(Rev. 2.00)
10.3 Clock Settings
10.3.1 RTCA Operating Clock
RTCA uses CLK_RTCA, which is generated by the clock generator from OSC1 as the clock source, as its operat-
ing clock. RTCA is operable when OSC1 is enabled.
To continue the RTCA operation during SLEEP mode with OSC1 being activated, the CLGOSC.OSC1SLPC bit
must be set to 0.
10.3.2 Theoretical Regulation Function
The time-of-day clock loses accuracy if the OSC1 frequency f
OSC1
has a frequency tolerance from 32.768 kHz. To
correct this error without changing any external part, RTCA provides a theoretical regulation function. Follow the
procedure below to perform theoretical regulation.
1. Measure f
OSC1
and calculate the frequency tolerance correction value
“m [ppm] = -{(f
OSC1
- 32,768 [Hz]) / 32,768 [Hz]}
×
10
6
.”
2. Determine the theoretical regulation execution cycle time “n seconds.”
3. Determine the value to be written to the RTCACTLH.RTCTRM[6:0] bits from the results in Steps 1 and 2.
4. Write the value determined in Step 3 to the RTCACTLH.RTCTRM[6:0] bits periodically in n-second cycles us-
ing an RTCA alarm or second interrupt.
5. Monitor the RTC1S signal to check that every n-second cycle has no error included.
The correction value for theoretical regulation can be specified within the range from -64 to +63 and it should be
written to the RTCACTLH.RTCTRM[6:0] bits as a two’s-complement number. Use Eq. 10.1 to calculate the cor-
rection value.
m
RTCTRM[6:0] = ——
×
256
×
n
(However, RTCTRM[6:0] is an integer after rounding off to -64 to +63.)
(Eq. 10.1)
10
6
Where
n: Theoretical regulation execution cycle time [second] (time interval to write the correct value to the
RTCACTLH.RTCTRM[6:0] bits periodically via software)
m: OSC1 frequency tolerance correction value [ppm]
Figure 10.3.2.1 shows the RTC1S signal waveform.
RTC1S
RTCACTLH.RTCTRMBSY
32,768/f
OSC1
[s]
Theoretical regulation execution cycle time n [s]
32,768/f
OSC1
± ∆
T [s]
∗ ∆
T = correction time set in the RTCACTLH.RTCTRM[6:0] bits
Writing to the RTCACTLH.RTCTRM[6:0] bits
Theoretical regulation
completion interrupt
Figure 10.3.2.1 RTC1S Signal Waveform
Table 10.3.2.1 lists the frequency tolerance correction rates when the theoretical regulation execution cycle time n is
4,096 seconds as an example.
Table 10.3.2.1 Correction Rates when Theoretical Regulation Execution Cycle Time n = 4,096 Seconds
RTCACTLH.RTCTRM[6:0]
bits (two’s-complement)
Correction
value (decimal)
Correction rate
[ppm]
RTCACTLH.RTCTRM[6:0]
bits (two’s-complement)
Correction
value (decimal)
Correction rate
[ppm]
0x00
0
0.0
0x40
-64
-61.0
0x01
1
1.0
0x41
-63
-60.1
0x02
2
1.9
0x42
-62
-59.1
0x03
3
2.9
0x43
-61
-58.2
· · ·
· · ·
· · ·
· · ·
· · ·
· · ·
0x3e
62
59.1
0x7e
-2
-1.9
0x3f
63
60.1
0x7f
-1
-1.0
Minimum resolution: 1 ppm, Correction rate range: -61.0 to 60.1 ppm