ST AN934 Application note

ST AN934 Application note

AN934

Application note

How to use the digital calibration feature in TIMEKEEPER® and serial real-time clock (RTC) products

Introduction

The term “quartz accurate” has become a familiar phrase used to describe the accuracy of many time keeping functions. Quartz oscillators provide an accuracy far superior to other conventional oscillator designs, but they are not perfect. Quartz crystals are sensitive to temperature variations. Figure 1 shows the relationship between accuracy (acc), temperature (T), and curvature (K) for the 32,768Hz crystal used on STMicroelectronics TIMEKEEPER® products. The curves follow this general formula:

acc = K × ( T TO)2

where TO = 25 °C ± 5 °C and K = –0.036 ppm/°C2 ± 0.006 ppm/°C2.

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

–40

–30

–20

–10

 

 

 

0

 

 

 

–50

 

 

 

–100

 

 

 

–150

 

 

 

–200

+35 ppm

10

20

30

40

50

60

70

80

90

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Temperature (°C)

–35 ppm

Accuracy (ppm)

Minimum K at 25°C

Typical K at 25°C

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® package, along with the battery. A typical TIMEKEEPER device is 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.

Figure 2. Oscillator divider chain

32768Hz

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Low

 

 

 

 

 

 

 

 

 

 

 

 

 

Current

 

div 64

 

 

div 2

 

 

Calibration

 

 

 

Clock

Oscillator

 

 

 

 

 

 

 

Circuitry

 

 

 

Registers

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

512Hz Output

 

 

 

 

 

64 Minute

 

 

 

 

 

 

 

 

 

 

 

256Hz

Cycle

 

 

 

 

 

 

for Frequency Test

 

 

 

 

 

 

 

 

1Hz Signal

AI02800

Figure 3. Clock splitting and clock blanking

No Calibration

Positive Clock Calibration

Negative Clock Calibration

AI02801

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 64minute 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 (CL). Thus, if the crystal has a CL that is different from the actual 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 Table 1 on page 6.

Figure 4.

 

Control register

 

 

 

 

 

 

 

 

 

d7

 

d6

 

d5

 

d4

d3

 

d2

d1

d0

 

x(1)

 

y(2)

 

S

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AI05651

 

 

 

Sign Bit

 

 

 

Calibration Value

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.x = W (Parallel device); OUT (Serial device)

2.y = R (Parallel device); FT (Serial device)

Doc ID 6393 Rev 4

5/14

Loading...
+ 9 hidden pages