
DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
541 of 808
NXP Semiconductors
UM10360
Chapter 27: LPC17xx Real-Time Clock (RTC) and backup registers
6.5 Calibration procedure
The calibration logic can periodically adjust the time counter either by not incrementing
the counter, or by incrementing the counter by 2 instead of 1. This allows calibrating the
RTC oscillator under some typical voltage and temperature conditions without the need to
externally trim the RTC oscillator.
A recommended method for determining the calibration value is to use the CLKOUT
feature to unintrusively observe the RTC oscillator frequency under the conditions it is to
be trimmed for, and calculating the number of clocks that will be seen before the time is off
by one second. That value is used to determine CALVAL.
If the RTC oscillator is trimmed externally, the same method of unintrusively observing the
RTC oscillator frequency may be helpful in that process.
Backward calibration
Enable the RTC timer and calibration in the CCR register (set bits CLKEN = 1 and
CCALEN = 0). In the CALIBRATION register, set the calibration value CALVAL
≥
1 and
select CALDIR = 1.
•
The SEC timer and the calibration counter count up for every 1 Hz clock cycle.
•
When the calibration counter reaches CALVAL, a calibration match occurs and all
RTC timers will be stopped for one clock cycle so that the timers will not increment in
the next cycle.
•
If an alarm match event occurs in the same cycle as the calibration match, the alarm
interrupt will be delayed by one cycle to avoid a double alarm interrupt.
Forward calibration
Enable the RTC timer and calibration in the CCR register (set bits CLKEN = 1 and
CCALEN = 0). In the CALIBRATION register, set the calibration value CALVAL
≥
1 and
select CALDIR = 0.
•
The SEC timer and the calibration counter count up for every 1 Hz clock cycle.
Table 501. Calibration register (CALIBRATION - address 0x4002 4040) bit description
Bit
Symbol
Value
Description
Reset
value
16:0
CALVAL
-
If enabled, the calibration counter counts up to this
value. The maximum value is 131, 072 corresponding
to about 36.4 hours. Calibration is disabled if CALVAL
= 0.
NC
17
CALDIR
Calibration direction
NC
1
Backward calibration. When CALVAL is equal to the
calibration counter, the RTC timers will stop
incrementing for 1 sec.
0
Forward calibration. When CALVAL is equal to the
calibration counter, the RTC timers will jump by 2 sec.
31:12
Reserved, user software should not write ones to
reserved bits. The value read from a reserved bit is
not defined.
NA