English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (485/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
21.4.1 CALIBRATION
The real-time crystal input can be calibrated using the
periodic auto-adjust feature. When properly calibrated,
the RTCC can provide an error of less than 0.66 sec-
onds per month. Calibration has the ability to eliminate
an error of up to 260 ppm.
The calibration is accomplished by finding the number
of error clock pulses and writing this value into the CAL
field of the RTCCCON register (RTCCON<9:0>). This
10-bit signed value will either be added or subtracted
from the RTCC timer, once every minute. Refer to the
steps below for RTCC calibration:
1. Using another timer resource on the device, the
user must find the error of the 32.768 kHz
crystal.
2. Once the error is known, it must be converted to
the number of error clock pulses per minute.
EQUATION 21-1: ERROR CLOCKS PER
MINUTE
(Ideal Frequency (32,758) – Measured Frequency)
* 60 = Error Clocks per Minute
3. a) If the oscillator is faster than ideal (negative
result from step 2), the CAL bits register value
needs to be negative. This causes the specified
number of clock pulses to be subtracted from
the timer counter, once every minute.
b) If the oscillator is slower than ideal (positive
result from step 2), the CAL bits register value
needs to be positive. This causes the specified
number of clock pulses to be added to the timer
counter, once every minute.
4. Load the CAL bits (RTCCON<9:0>) with the cor-
rect value.
Writes to the CAL bits should only occur when the timer
is turned off, or immediately after the rising edge of the
seconds pulse (except when the seconds
(RTCTIME<15:8>) field is ‘00’ due to the possibility of
the auto-adjust event).
Note:
It is up to the user, to include in the error
value, the initial error of the crystal drift,
due to temperature and drift due to crystal
aging.
A write to the seconds bits resets the state
of calibration (not its value). If an adjust-
ment just occurred, it will occur again
because of the minute roll over.
PIC32MX3XX/4XX
© 2008 Microchip Technology Inc.
Preliminary
DS61143E-page 483