UM10360 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2013. All rights reserved.
User manual Rev. 3 — 19 December 2013  568 of 841
NXP Semiconductors
UM10360
Chapter 27: LPC176x/5x Real-Time Clock (RTC) and backup registers
 
27.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.
• When the calibration counter reaches CALVAL, a calibration match occurs and the 
RTC timers are incremented by 2.
• When the calibration event occurs, the LSB of the ALSEC register is forced to be one 
so that the alarm interrupt will not be missed when skipping a second.
Table 519. 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 second.
0 Forward calibration. When CALVAL is equal to the calibration counter, the RTC timers 
will jump by 2 seconds. 
31:12 Reserved, user software should not write ones to reserved bits. The value read from a 
reserved bit is not defined.
NA