6 calibrating the rtc oscillator, Sing the, Ay of the – Maxim Integrated High-Speed Microcontroller User Manual
Page 160: Hoosing an, Rystal
High-Speed Microcontroller User’s Guide
Rev: 062210
160 of 176
14.6 Calibrating the RTC Oscillator
Although the DS87C530 RTC accuracy is guaranteed for ±2 minutes per month, users may occasionally
require greater accuracy. The RTC incorporates the ability to adjust the internal capacitance of the crystal
amplifier via the RTC Trim Bits (TRM2–TRM0 and
TRM2–TRM0). This allows the user to more
accurately match the capacitance of the crystal amplifier to the crystal. Note that under most
circumstances no adjustment of the RTC crystal capacitance is necessary, as it will default to a minimum
accuracy of ±2 minutes per month.
All of the crystal capacitance controls are located in the RTC trim register (
bit will enable the output of a 4096Hz signal on P1.7. This signal is derived from a divide-by-8 of the
32.768kHz crystal. Because this is directly generated from the RTC, it can be used to determine the actual
frequency of the RTC. By adjusting the value of the TRMx bits, the internal capacitance of the RTC can
be varied, slightly slowing or speeding up the RTC frequency. The combination of TRMx bits
(
.5–0) that causes the output on pin P1.7 to most closely approximate 4096Hz provides the most
accurate setting of RTC capacitance.
As a precaution against accidental corruption of the oscillator trim bit settings, the
TRMx bits must be
programmed in the same instruction to the inverse of their respective TRMx bits. For example, if a trim
bit setting of 5 (101) was desired, the TRMx bits should be set to 2 (010). An illegal combination will
automatically reset the
register to 0x100101b. This will disable the E4K signal on P1.7, but leave
the X12/6 bit unmodified.
Refer to Application Note 79: Using the DS87C530/DS5250 Real-Time Clock for more information about
calibrating the RTC oscillator for improved accuracy.