About ST
Products
Applications
Support
Buy
News & Events
ST Worldwide
Contact Us
Login
Application Notes
|
Cross-Industry
|
General Purpose Products
|
Timekeeper
|
Timekeepers
TIMEKEEPER® calibration
Application Note
Format:
(155 kb)
or
(19 kb)
Last Updated: 20/02/2008
Pages: 12
Related Datasheets
3.0/3.3 V I2C serial RTC with 44 bytes of NVRAM and supervisory functions
3.0/3.3V I2C combination serial RTC, NVRAM supervisor and microprocessor supervisor
3.3V TIMEKEEPER® supervisor
5.0 or 3.3 V TIMEKEEPER® supervisor
5.0 or 3.3V, 256 Kbit (32 Kbit x 8) TIMEKEEPER® SRAM
5.0V, 16 Kbit (2Kb X 8) TIMEKEEPER SRAM
5V, 256 Kbit (32 Kb x 8) TIMEKEEPER® SRAM
5V, 64 Kbit (8 Kb X 8) TIMEKEEPER SRAM
64 Kbit (8 Kbit X 8) TIMEKEEPER® SRAM
Serial access phantom RTC supervisor
Serial access real-time clock with alarm
Serial real-time clock
Serial real-time clock with 56 bytes of NVRAM
Raw Ascii Text
- (
Hide
)
(Unformatted textual content of the document used by search engines)
AN934 APPLICATION NOTE
TIMEKEEPER Calibration
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: a c c = K × ( T TO )
2
where TO = 25C 5C 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 +35 ppm 40 30 20 10 0 35 ppm 50 10 20 30 40 50 60 70 80 90
Temperature (C)
100
Minimum K at 25C
Typical K at 25C Accuracy (ppm) 150 Maximum K at 25C
200
AI02498
November 2004
1/12
AN934 - APPLICATION NOTE
TABLE OF CONTENTS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Figure 1. Typical Crystal Accuracy plotted against Temperature (and against Different Values of K)1 METHODOLOGY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Figure 2. Figure 3. Figure 4. Table 1. Oscillator Divider Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Clock Splitting and Clock Blanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Calibration Table: Compensation Values in seconds per month (30 days) and in ppm . . 5
CALCULATING THE NEEDED AMOUNT OF CALIBRATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 CALCULATING CALIBRATION OVER A TEMPERATURE RANGE . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Figure 5. Crystal Accuracy over a Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 CALCULATING THE CALIBRATION FOR MULTIPLE OPERATING TEMPERATURES . . . . . . . . . . 8 ENA BLING THE FREQUENCY TEST FUNCTION (FT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 6. A Day of the Week Register (for Parallel Devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 7. 512H z Output to DQ0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Table 2. 512H z Output Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 REVISION HISTORY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Table 3. Document Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2/12
AN934 - APPLICATION NOTE
METHODOLOGY
The STMicroelectronics TIMEKEEPER products are driven by a quartz crystal-controlled oscillator with a nominal frequency of 32.768kHz. The crystal is mounted in either a 600mil DIP CAPHATTM package, 600mil DIP Hybrid, 300mil SOIC Embedded Crystal, or in a 330mil 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 25C 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, (with the exception of the M48T86 device, which does not have the calibration register), employs periodic counter correction. The digital calibration circuit adds or subtracts counts from the oscillator divider circuit at the 256Hz 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 Oscillator
div 64
div 2
Calibration Circuitry 64 Minute Cycle
Clock Registers
512Hz Output for Frequency Test
256Hz 1Hz Signal
AI02800
Figure 3. Clock Splitting and Clock Blanking
No Calibration Positive Clock Calibration Negative Clock Calibration
AI02801
3/12
AN934 - APPLICATION NOTE
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., page 5 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., page 1 , the peak of the curve corresponds to approximately 25C. 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.768kHz (no error). However, variations from one crystal to another may cause the turnover point to be slightly above or below 32.768kHz. 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.768kHz (1Hz). At STMicroelectronics, the real-time clock has an internal capacitance of 12.5pF (except for the M41T6x device, which has an internal capacitance of 6pF) 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., page 5. Figure 4. Control Register
d7 x (1) d6 y(2) d5 S Sign Bit
AI05651
d4
d3
d2
d1
d0
Calibration Value
Note: 1. x = W (Parallel device); OUT (Serial device) 2. y = R (Parallel device); FT (Serial device)
4/12
AN934 - APPLICATION NOTE
Table 1. Calibration Table: Compensation Values in seconds per month (30 days) and in ppm
Calibration Value (Binary) 0 0 0 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111 In general: N 337*N/32 169*N/32 337*N/(32*2.592) 169*N/(32*2.592) Value in Seconds Per Month (30 days) Rounded to the Nearest Second Plus 0 11 21 32 42 53 63 74 84 95 105 116 127 137 148 158 169 179 190 200 211 221 232 243 253 264 274 285 295 306 316 327 Minus 0 5 11 16 21 26 32 37 42 47 53 58 63 69 74 79 84 90 95 100 105 111 116 121 127 132 137 142 148 153 158 163 Value in ppm Rounded to the Nearest ppm Plus 0 4 8 12 16 20 24 28 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 98 102 106 110 114 118 122 126 Minus 0 2 4 6 8 10 12 14 16 18 20 22 24 26 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63
5/12
AN934 - APPLICATION NOTE
CALCULATING THE NEEDED AMOUNT OF CALIBRATION
There are two methods for establishing how much calibration are required in a given application. The first method can be easily implemented in the user environment simply by setting the clock to a known accurate reference and then storing the time in some unused location in the RAM. Over a period of time (30 days), the reference time is compared to the current time (the average ambient temperature should be considered as well). This will tell the user how fast or slow the clock operates for a period of 30 days. While it may seem crude, it allows the designer to give the end user the ability to calibrate the clock according to the specified environment. The ability to calibrate the clock can also be accomplished even after the final product is packaged in a non-user serviceable enclosure by providing a simple utility to access the calibration byte. Table 1., page 5 provides a direct look-up table for calibration values based upon the number of seconds lost or gained during a one month (30 day) period. For example, if the system were to lose 20 seconds during one month, the needed calibration would be +20 seconds. The user could look up a +20 second value in the table under the appropriate column. In this case, the nearest value is +21. The appropriate sign bit in this case is a logical '1,' indicating the clock needs to speed up to compensate for the lost time. This yields a calibration value of "100010." In this example, the inaccuracy would be reduced from 20 seconds per month to +1 second per month. The second approach is better suited for a manufacturing environment, and involves the use of a special test mode (as described in the section entitled, "ENABLING THE FREQUENCY TEST FUNCTION (FT), page 9" which derives a 512Hz signal from the clock divider chain, as indicated in Figure 2., page 3. This signal can be used to measure the accuracy of the crystal oscillator. The right-hand pair of columns in Table 1., page 5 provides a look-up table similar to that in the left-hand pair of columns, except that the error values are expressed in "ppm" units instead of seconds per month. The error in ppm can be quickly calculated by dividing the measured error from 512Hz by 512 and multiplying the result by 1 million. For example, if the frequency measured during the test mode is 511.998Hz, the delta is 0.002. Dividing by 512 and multiplying by 1 million, the result is 3.906 ppm. In this case, the nearest compensation value is a +4.068. The appropriate sign bit in this case is a logical '1,' indicating the clock needs to speed up to compensate for the lost time. This yields a calibration value of "100001."
6/12
AN934 - APPLICATION NOTE
CALCULATING CALIBRATION OVER A TEMPERATURE RANGE
The calibration procedure described so far has centered around calculating the correction for a specific temperature. This section considers the procedure for minimizing the frequency error over a wider temperature range. This involves adjusting the frequency curve so that there is an equal amount of error above and below the zero (0) ppm point. Figure 5 shows how the frequency error can be minimized over a given temperature range. The variables in the equation (see INTRODUCTION, page 1) are as follows: K = Curvature characteristic = 0.036 ppm/C2 0.006 ppm/C2 acc = Accuracy, in ppm, of the frequency, at the turnover temperature TO = Turnover temperature, in degrees Celsius = 25C 5C T = Working temperature, in degrees Celsius For example, if a device is in error by +20 ppm at room temperature, but will actually operate at 20C in the application, the equation on page 1 may be used to calculate the required calibration value as follows: acc = 20 ppm + (0.036ppm/C2) * (20C 25C)2 acc = 52.9 ppm Since the unit will be slow by 52.9 ppm, the required correction is +52.9ppm, and this can be looked up in Table 1., page 5; the nearest value is a +53. The appropriate sign bit in this case is a logical '1,' indicating the clock needs to speed up to compensate for the lost time. This yields a calibration value of "101101." Figure 5. Crystal Accuracy over a Temperature Range
50 20 40 30 20 10 0 10 20 30 40 50 60 70 80 90
Temperature C
50
After calibration 100
Before calibration
200
Accuracy (ppm)
150
AI02499
7/12
AN934 - APPLICATION NOTE
CALCULATING THE CALIBRATION FOR MULTIPLE OPERATING TEMPERATURES
For applications that spend significant time at more than one temperature, the following equation may be used to calculate the appropriate amount of calibration required:
N t=
i=1
t P E R i ( a c c + K × ( T i T o ) ) × 10
2
6
where: K = Curvature characteristic = 0.036 ppm/C2 0.006 ppm/C2 acc = Accuracy, in ppm, of the frequency, at the turnover temperature TO = Turnover temperature, in degrees Celsius = 25C 5C Ti = Working temperature, in degrees Celsius tPERi = Amount of time it is in the temperature range (in seconds) t = Amount of time lost during tPERi N = Number of temperature ranges Consider a piece of portable equipment used outdoors for 8 hours per day, then stored at room temperature for the remainder of the day. The equation below calculates the calibration value at 20C for a period of 8 hours and then room temperature for the rest of the day for a device that is currently in error by +5 ppm at room temperature: 8 h o u r s = 28800 s ec o n d s 16 h o u r s = 57600 sec o n d s
= { [ ( 28800 sec s ) × ( 5 + ( ( 0.036 p p m / C ) × ( 20 C 25 C ) ) ) ] +
2
2
[ ( 57600 sec s ) × ( 5 + 0 ) ] } × 10
6
t = 1. 67 s ec s / d a y The unit is losing 1.67 seconds per day (or 50 seconds per month). The appropriate sign bit in this case is a logical "1," indicating the clock needs to be sped up to compensate for the lost time. This yields a calibration value of "100101."
8/12
AN934 - APPLICATION NOTE
ENABLING THE FREQUENCY TEST FUNCTION (FT)
Figure 4., page 4 and Figure 6 show the location of the Frequency Test (FT) Bit, DQ6, of the Day-of-theWeek register for the parallel device or DQ6 in the control register for the serial device. Setting the FT Bit to a '1' turns on the frequency test mode. The user needs to make sure that the Stop (ST) Bit in the second register, is set to a '0.' Exactly where the 512Hz signal is output depends on which TIMEKEEPER device is being used, as indicated in Table 2. On the M48T02, M48T12, M48T08, M48T18, and M48T35 devices, the 512Hz signal is output on the DQ0 pin when the device is reading the Seconds register. The address and control signals must be valid during the measurement process, as shown in Figure 7., page 9. On the M41T62, M41T63, and M41T64, the 512Hz signal is output on the SQW pin. To enable the 512Hz signal, the SQWE Bit = 1 (DQ6 of the alarm month register), RS3 = 0, RS2 = 1, and RS1 = 0 (DQ7-DQ4 in the day register). The SQW output pin is an open drain output for M41T64 and a full CMOS output for the M41T62 and M41T63. For all other devices listed in Table 2., page 10, the 512Hz signal is output on the FT/OUT, FT, IRQ/FT, and IRQ/FT/OUT pins. These outputs are open drain, and require a pull-up resistor. A 500 to 10k resistor is recommended in order to control the rise time. Measurement should be taken from negative edge to negative edge due to the slow rise time on the positive edge. If the IRQ function is enabled, the FT function is inhibited. Note: Setting or changing the calibration byte does not affect the frequency test output frequency as the adjustment is made at the 256Hz stage. Once the amount of calibration has been determined, either from the test mode or by monitoring it over a period of time, the user can enter the values from the calibration tables into the Control Register. Figure 6. A Day of the Week Register (for Parallel Devices)
d7 d6 FT Freq. Test Bit Day of the Week
AI05652
d5
d4
d3
d2
d1
d0
Figure 7. 512Hz Output to DQ0
Address Bus Address for Seconds Register
E G
DQ0
512Hz Output
AI02802
Note: Care should be taken when writing to the Control Register so as not to overwrite the calibration value.
9/12
AN934 - APPLICATION NOTE
Table 2. 512Hz Output Pin
Device M41T00, M41T00S, M41T11, M41T56 M48T02/12, M48T08/18, M48T35 M41T256, M41T60, M48T58 M48T59, M48T559, M48T37, M48T201, M48T212, M48T212A M41ST84, M41ST85, M41ST87, M41ST95, M41ST97, M41T65, M41T81, M41T81S, M41T94 M41T62, M41T63, M41T64 Pin Name FT/Out DQ0 FT IRQ/FT IRQ/FT/OUT SQW
10/12
AN934 - APPLICATION NOTE
CONCLUSION
Software calibration is a convenient feature which allows the user to adjust the clock accuracy during manufacturing (or later) at minimal cost. This feature also provides a method whereby "drift" (due to temperature variation) can be corrected and/or anticipated. See http://www.st.com/nvram for additional details as well as an online calibration calculation tool.
REVISION HISTORY
Table 3. Document Revision History
Da te December 1998 20-May-03 16-Feb-04 11-Nov-04 Version 1.0 1.1 2.0 3.0 First Edition Clarify compensation required (Table 1, 2); add Conclusion Update web reference information Reformatted; updates to content (Figure 4, 6; Table 2) Revision Details
11/12
AN934 - APPLICATION NOTE
If you have any questions or suggestions concerning the matters raised in this document, please refer to the MPG request support web page: http://www.st.com/askmemory
Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not authorized for use as critical components in life support devices or systems without express written approval of STMicroelectronics. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners 2004 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com
12/12
Document Number: 6393