ST AN934 Application note

AN934
Application note
How to use the digital calibration feature in
TIMEKEEPER
Introduction
®
products. The curves follow this general formula:
®
and serial real-time clock (RTC) products
acc K T TO–()
×=
2
where T
= 25 °C ± 5 °C and K = –0.036 ppm/°C2 ± 0.006 ppm/°C2.
O
The clocks used in most applications require a high degree of accuracy, and there are several factors involved in achieving this accuracy. Typically most crystals are compensated by adjusting the load capacitance of the oscillator. This method, while effective, has several disadvantages:
1. It requires external components (trim capacitors); and
2. it can increase oscillator current (an important factor in battery-supported applications).
STMicroelectronics replaced this crude analog method with a digital calibration feature. This method gives the user software control over the calibration procedure which makes it user friendly.
Figure 1. Typical crystal accuracy plotted against temperature (and against
different values of K)
50
+35 ppm
–30
–20
–10
–50
–100
10
0
30
20
–35 ppm
50 60 70 80
Temperature (°C)
9040–40
Minimum K at 25°C
Typical K at 25°C
–150
–200
Accuracy (ppm)
Maximum K at 25°C
AI02498
October 2011 Doc ID 6393 Rev 4 1/14
www.st.com
Contents AN934
Contents
Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Calculating the needed amount of calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Calculating calibration over a temperature range . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Calculating the calibration for multiple operating temperatures . . . . . . . . . . . . . . 9
Enabling the frequency test function (FT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2/14 Doc ID 6393 Rev 4
AN934 List of figures
List of figures
Figure 1. Typical crystal accuracy plotted against temperature (and against different values of K) . . 1
Figure 2. Oscillator divider chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 3. Clock splitting and clock blanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 4. Control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 5. Crystal accuracy over a temperature range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 6. A day of the week register (for parallel devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 7. 512 Hz output to DQ0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Doc ID 6393 Rev 4 3/14
Methodology AN934

Methodology

The STMicroelectronics TIMEKEEPER® products are driven by a quartz crystal-controlled oscillator with a nominal frequency of 32.768 kHz. The crystal is mounted in either a 600 mil DIP CAPHAT™ package, 600 mil DIP hybrid, 300mil SOIC embedded crystal, or in a 330 mil SOIC SNAPHAT accurate within ±1.53 minutes (±35 ppm - parts per million) per month at 25 °C without calibration.
Two sources of clock error are:
temperature variation
crystal variation
As mentioned previously, most clock chips compensate for crystal frequency and temperature shift error with cumbersome “trim” capacitors. The TIMEKEEPER design employs periodic counter correction. The digital calibration circuit adds or subtracts counts from the oscillator divider circuit at the 256 Hz stage (see Figure 2).
Figure 3 shows how extra clock pulses are added (by clock splitting) or removed (by clock
blanking). The number of times the pulses are split (added during positive calibration) or blanked (subtracted during negative calibration) depends upon the value that has been loaded into the least significant five bits of the control register. Adding counts speeds the clock up while subtracting counts slows the clock down.
®
package, along with the battery. A typical TIMEKEEPER device is

Figure 2. Oscillator divider chain

32768Hz
Low
Current
Oscillator
512Hz Output
for Frequency Test
div 64
div 2
256Hz
Calibration
64 Minute

Figure 3. Clock splitting and clock blanking

No Calibration
Positive Clock Calibration
Negative Clock Calibration
Circuitry
Cycle
1Hz Signal
Clock
Registers
AI02801
AI02800
4/14 Doc ID 6393 Rev 4
AN934 Methodology
The calibration byte occupies the five lower order bits in the control register, as shown in
Figure 4. These bits represent the binary value between 0 and 31. Table 1 on page 6 shows
how many seconds (or ppm) each bit represents in real time for the TIMEKEEPER
®
product line. The sixth bit is a sign bit. A binary '1' indicates a positive calibration (added pulses), and a binary '0' indicates a negative calibration (blanked pulses). Calibration occurs within a 64­minute cycle. The first 62 minutes in the cycle may, once per minute, have one second either shortened by 128 or lengthened by 256 oscillator cycles. If a binary '1' is loaded into the register, only the first 2 minutes in the 64-minute cycle are modified; if a binary “6” is loaded, the first 12 minutes are affected, and so on.
Therefore, each calibration step has the effect of adding 512 or subtracting 256 oscillator cycles for every 125,829,120 actual oscillator cycles (64 minutes x 60 seconds/minute x 32,768 cycles/second). That is, +4.068 or –2.034 ppm of adjustment per calibration step in the calibration register. Assuming that the oscillator is running exactly at 32.768kHz, each of the 31 increments in the calibration byte represent +10.7 or –5.35 seconds per month, which corresponds to a total range of +5.5 or –2.75 minutes per month.
As can be seen from Figure 1 on page 1, the peak of the curve corresponds to approximately 25 °C. This is known as the “turnover temperature.” As the temperature rises or falls from room temperature, the oscillator slows down. Typically the turnover point on the graph is very close to 32.768 kHz (no error). However, variations from one crystal to another may cause the turnover point to be slightly above or below 32.768 kHz. The frequency variation for an uncalibrated device is a function of the crystal frequency variation for the given load capacitance (C
). Thus, if the crystal has a CL that is different from the actual
L
internal load capacitance of the device, then the oscillator frequency will run faster or slower than the 32.768 kHz (±1 Hz). At STMicroelectronics, the real-time clock has an internal capacitance of 12.5 pF (except for the M41T6x series, which has an internal capacitance of 6 pF) across the crystal input pins. For this reason, the calibration feature can be programmed to adjust for both negative and positive variations. Entering a value into the 6-bit calibration field of the control register will shift the entire curve up or down according to the values found in Table1 on page6.

Figure 4. Control register

d7
(1)
x
AI05651
1. x = W (Parallel device); OUT (Serial device)
2. y = R (Parallel device); FT (Serial device)
d6
(2)
y
d5
S
Sign Bit
d4
Doc ID 6393 Rev 4 5/14
d3
d2
Calibration Value
d1
d0
Loading...
+ 9 hidden pages