Timekeeping Accuracy, Automatic and Affordable
- Benjamin Franklin
If Benjamin Franklin had to use a quartz crystal and an RTC to maintain the time of day, he may have rethought his statement. The inaccuracy of the crystal over temperature usually makes time appear to delay (or, occasionally, to move quicker).
An RTC with a 32.768kHz quartz tuning-fork crystal oscillator is the standard timekeeping reference for most electronic applications. The RTC maintains the time and date by counting seconds, which requires a 1Hz clock signal derived from the 32.768kHz crystal oscillator. The current time and date information is stored in a set of registers, which is accessed through a communication interface.
The ProblemThere is nothing inherently wrong with using an RTC for timekeeping. However, the time will only be as accurate as the reference used. Unfortunately, the typical 32.768kHz tuning-fork crystal does not provide much accuracy over a wide temperature range. Due to its parabolic nature over temperature (Figure 1), this accuracy is typically ±20ppm at room temperature (+25°C). This is the equivalent of gaining or losing 1.7 seconds of time each day, or 10.34 minutes per year. As Figure 1 shows, accuracy decreases at more extreme high and low temperatures. The typical accuracy at these temperatures is much worse than 150ppm, which is the equivalent to losing almost 13.0 seconds of time each day, or over 1.3 hours per year.
Figure 1. Temperature vs. accuracy of a typical 32.768kHz tuning-fork crystal.
The frequency deviation (Δf) of a typical crystal at a specific frequency (f) and temperature (T) is:
Δf/f = k(T - To)2 + fo
where f is the nominal crystal frequency, k is the curvature constant, T is the temperature, To is the turnover temperature, and fo is the frequency deviation at room temperature.
An analysis of this equation reveals only three variables that control each crystal's frequency response over temperature. These are the curvature constant, turnover temperature, and room-temperature frequency deviation. The curvature constant has the most effect on the parabolic nature of the frequency deviation over temperature, but this constant has a very small deviation. Different turnover temperatures shift the deviation curve left or right, and different frequency deviations at room temperature shift the curve up or down.
Various SolutionsFor applications that demand accuracy in timekeeping, there have been limited options available to improve upon the crystal inaccuracies. Applications can improve timekeeping accuracy through crystal screening, integrated crystals, calibration registers, or temperature-compensated crystal oscillators.
Crystal ScreeningOne option to improve timekeeping is to have a supplier provide crystals that fall within a specified range of room-temperature accuracy. This requires the supplier to analyze each crystal's frequency deviation at room temperature before shipment, obviously adding to the cost of the crystal. This method has no effect on the parabolic nature of the crystal's accuracy curve.
By using a screening process, a crystal manufacturer could provide a subset of crystals that improve the room temperature accuracy from ±20ppm to ±10ppm or ±5ppm. These "improved" crystals would still suffer from large inaccuracies at high and low temperatures.
Depending on the level of accuracy and load capacitance required, there would also be a yield loss. This could result in an insufficient quantity of acceptable crystals.
A manufacturer can also control the crystal turnover temperature by the angle the crystal is originally cut, but this is impractical and costly. Crystal manufacturers use many automated processes, but are still hard pressed to keep up with demand. The probability of inducing a manufacturer to interrupt his manufacturing sequence for a nonstandard part is low.
Integrated CrystalsTaking the crystal-screening process one step further, some companies include the tuning-fork crystal in the same package as the timekeeping device, which shifts the burden of providing crystals to the device manufacturer. Providing an integrated crystal reduces the designer's workload by eliminating crystal procurement issues. This alleviates concerns about the crystal parameters matching up with the timekeeping device requirements, and reduces printed circuit board (PC board) layout issues.
Companies that are not vertically integrated do not have the ability to measure or trim the crystal parameters. These companies purchase crystals from a supplier and assemble the die and crystal into a single package. No accuracy improvement is expected with this option. Dallas Semiconductor provides this type of integrated device with the DS1337C, DS1338C, DS1339C, DS1340C, and DS1374C. These are excellent devices for applications that do not require a high level of accuracy.
Other companies that manufacture their own crystals have the ability to place a crystal blank, which is the unpackaged quartz, in a smaller, hermetically sealed package and trim the blank to meet certain accuracy requirements. As mentioned in the previous section, this method does not change the parabolic curve, but only provides a small accuracy improvement at room temperature. The improvements at high and low temperatures are negligible. The downside of this method is that the ceramic package and crystal trimming add cost to the total solution.
Temperature CompensationTo achieve timekeeping accuracy over a wide temperature range, some form of temperature compensation is required. Temperature compensation requires periodic measurement of temperature, and subsequent adjustment of either the crystal loading or the clock source according to the measured temperature.
Temperature compensation can be accomplished in one of two ways. The first option is to develop a temperature compensation algorithm by using a temperature sensor with a timekeeping device that provides some form of analog or digital clock calibration. This method usually requires an extensive development and calibration investment. The second option is to use an off-the-shelf, temperature-compensated crystal oscillator (TCXO) as the clock source for an RTC.
Calibration RegisterSome RTCs, like the DS1340, provide a digital calibration register that can be used to periodically adjust the time of day in discrete amounts. This method does not attempt to alter the crystal behavior at all, but instead, periodically adjust time according to the expected frequency deviation at a specified temperature. The effect is to move the 32.768kHz parabolic curve up or down to approach 0.0ppm accuracy at a desired temperature. This is accomplished by adding or subtracting clock cycles from the oscillator divider chain. The number of clock pulses removed (subtracted for negative calibration) or inserted (added for positive calibration) is set by the value in the calibration register. By adding clock pulses, time is sped up (the crystal curve moves up); by subtracting clock pulses, time is slowed down (the crystal curve moves down). Figure 2 shows how the typical crystal curve is shifted upward until the accuracy approaches 0.0ppm. In this example, the measured temperature is +55°C.
Figure 2. Typical crystal curve is shifted upward until the accuracy approaches 0.0ppm.
An RTC with a calibration register can be combined with a temperature sensor to achieve accuracy levels from -2.034ppm to +4.068ppm at one specific temperature. The total adjustment range is from -126ppm to +63ppm so, at extreme high and low temperatures, the curve cannot be adjusted enough to achieve 0.0ppm. Processor overhead is required to periodically measure the temperature, calculate the new calibration register value, and adjust the appropriate RTC register.
The major difficulty with this method is the required factory-calibration effort. Because each crystal behaves differently, a custom calibration table for the desired temperature range is essential for each timekeeping device. The amount of manpower and time needed for such an effort could become cumbersome. Some amount of nonvolatile memory is also necessary to store the calibration data, adding to the overall cost. In addition, the compensation values do not compensate for the inevitable crystal aging, which can approach ±3ppm for the first year alone. While the calibration register method does not provide automatic adjustments as the temperature changes, it still provides an incremental improvement in accuracy.
Temperature-Compensated Crystal OscillatorAnother option to greatly improve timekeeping accuracy is to use a 32.768kHz temperature-compensated crystal oscillator (TCXO), like the DS32kHz, as the clock source for a stand-alone RTC. These devices are factory calibrated, and can provide accuracy as good as ±7.5ppm over the industrial temperature range (-40°C to +85°C). The effect of a TCXO is to flatten the parabolic nature of the crystal curve over temperature (Figure 3).
Figure 3. Crystal curve flattened by a TCXO.
A TCXO includes an integrated sensor to periodically measure device temperature. The measurement is used to access a lookup table, whose output is used to calculate and apply a load-capacitance value for the integrated 32.768kHz crystal to achieve 0.0ppm accuracy. The lookup table exists on the device and requires no external inputs.
When a crystal is manufactured, it is optimized for a particular load capacitance, which is specified in the data sheet. If the actual load capacitance does not match the specification, the result is a deviation from the nominal frequency. This fact is utilized by a TCXO to improve accuracy. If the amount of frequency deviation at each temperature is known for a specific crystal, the TCXO can adjust the load capacitance to offset the temperature-dependent frequency deviation.
The advantage of using an off-the-shelf TCXO is that no algorithm development or factory calibration is required. The downsides are the additional cost and PC-board space required by a multichip solution.
The Most Accurate Solution—RTC/TCXO/Crystal IntegrationThe ideal accurate timekeeping device would be one that integrates an RTC, a TCXO, and a quartz crystal into a single package. The DS3231S is such a device. It provides unparalleled accuracy of ±2.0ppm from 0°C to +40°C, which is the equivalent of just over ±1.0 minute each year. Accuracy from -40°C to 0°C and +40°C to +85°C is ±3.5ppm, which is the equivalent of ±1.8 minute each year. The worst-case accuracy of this device is displayed in Figure 4. As mentioned in the previous section, the integrated TCXO flattens the parabolic nature of the crystal curve over temperature.
Figure 4. Worst-case accuracy of the DS3231S.
Like the previous TCXO solution, the integrated device is factory calibrated and requires no customer calibration or development effort. The single-package solution combines the same functionality in a smaller area and at a reduced cost.
Unlike a stand-alone TCXO, the integrated device register set is accessible through the serial-interface port. An on-chip aging register provides an adjustment for load capacitance and temperature compensation. This allows an application to also compensate for accuracy lost due to crystal aging.