Thursday, April 7, 2022

How to make low power consumption and high efficiency accurate compensation for real-time clock

The real-time clock (RTC) has never been a compelling component of a system. It’s true that many engineers don’t understand why an RTC is needed. They might think it’s a very simple component that just keeps track of time. Also, most microcontrollers today have a built-in RTC.

This article was compiled from EDN, author Gordon Lee, Senior Technician, Application Products, Core Products Department, Maxim Integrated

The real-time clock (RTC) has never been a compelling component of a system. It’s true that many engineers don’t understand why an RTC is needed. They might think it’s a very simple component that just keeps track of time. Also, most microcontrollers today have a built-in RTC.

So why would a system engineer spend more money and be willing to waste more PCB space for an RTC? Why are standalone RTCs no longer obsolete? This article will highlight the importance of RTC in different applications and outline the key RTC specifications and associated design challenges.

In the past, before the Internet became widespread, high-precision RTCs were essential for countless applications such as personal computers, Electronic watches, camcorders, and vehicles. The RTC keeps track of time even when the main power is turned off. Without RTC, the user would need to set the time and date every time they turn on the device.

Today’s electronic devices can access the Internet or GPS. Once your device is connected, you can easily get the most accurate time. A high-precision RTC is really unnecessary for those devices that have a constant internet connection, but this benefit comes at the cost of high power consumption.

Why you still need RTC now

Over the past decade, with the rise of various automation applications, billions of devices are now Internet-enabled. Everyday objects such as security cameras, lights, entertainment systems and equipment can now be connected to the Internet. These devices are part of the Internet of Things (IoT) trend. But while battery-powered IoT devices are driving a lot of IoT market growth, devices that are continuously connected to a power source are also a large portion of IoT.

So, is the RTC era over? not really. More and more RTCs are actually being used in many automation and IoT applications. Many remote IoT sensors, such as weather stations, are mostly battery powered and take measurements or complete tasks on a preset schedule. These devices cannot keep the wireless transceiver enabled as this will drain the battery very quickly.

It’s true that engineers put a lot of thought into the technology to extend battery life. For the most part, these battery-powered devices, including microcontrollers, run in deep sleep mode to minimize wear and tear during periods of no task execution. These applications benefit from an extremely low RTC and can wake up the system from time to time to perform assigned tasks.

Although microcontrollers usually have a built-in RTC, timing current is usually measured in mA. A standalone RTC, on the other hand, consumes only nA of current when running. One RTC, for example, consumes only 150 nA in watch mode and provides two alarm settings and two interrupt pins that can be used to wake up the system.

Don’t underestimate the difference between a few mA and 150 nA. When designing IoT applications to extend battery life, every mA of current counts. In addition to IoT applications, many medical devices require nanopower-level RTCs. Examples include wearable ECG devices, hearing aids and medical labels.

Most battery-operated devices are designed to be small enough to be portable or easy to install. Since the separate RTC is external to the microcontroller, an RTC with a smaller package is preferred. Even better, engineers can opt for an RTC with an integrated resonator if board space is limited. Currently, the industry’s smallest integrated resonator RTC comes in a 2.1 x 2.3 mm 8-pin WLP package.

In addition to low power consumption and small package size, some applications require high timing accuracy over a wide temperature range. This is an important consideration for field-installed sensors, for example, where the temperature can fluctuate widely throughout the day. For these applications, a better choice is an RTC with temperature compensation, which will be discussed in Part 2 of this article series.

RTC with external crystal

Cost-effective RTCs often require external resonators, and the most common resonator for RTCs is a 32.768 kHz quartz crystal. Why 32.768 kHz? First, 32768 is a power of 2 function. When this signal is connected to a 15-level flip-flop, the output is an exact 1 Hz signal. The RTC uses this 1 Hz signal to drive the timing logic. But why 32.768 kHz instead of 131.072 kHz or 1.024 kHz? To answer this question, we need to understand the trade-off between frequency and power consumption. In general, current consumption increases as the crystal frequency increases.

And crystal size is inversely proportional to frequency, which means lower frequency crystals are physically larger and take up more board space. Therefore, 32.768 kHz was chosen as the best compromise between power and size. Also, the human hearing range is 20 Hz to 20 kHz. If the frequency is below 20 kHz, one can hear the crystal vibrating. 32.768 kHz is the first frequency to the power of 2 that exceeds the audible range.

The quartz crystal is factory calibrated and can be oscillated at the target frequency by adding a small amount of gold to the tip of the tuning fork to fine-tune the vibration speed. The resulting clock accuracy is typically within ±20 ppm at room temperature with the specified capacitor load. The ppm unit, short for parts per million, is the unit commonly used for the measurement of clock accuracy.

Assuming a constant ambient temperature of 25°C throughout the year, in this case, an RTC of ±20 ppm gives an accuracy of up to 10.5 minutes per year. The calculation is as follows:

How to make low power consumption and high efficiency accurate compensation for real-time clock

Calculate the formula for 10.5 minutes

If the temperature fluctuates, the cumulative error may increase. If buyers are willing to pay extra, suppliers can provide crystals with higher precision through a screening process. However, no matter how accurate these crystals are at room temperature, their frequency is still affected by three factors:

temperature fluctuation

Frequency pull-up with load capacitor

Ageing

temperature fluctuation

The frequency of a crystal oscillator is a function of temperature and can be approximated by a second-order equation:

How to make low power consumption and high efficiency accurate compensation for real-time clock

crystal frequency equation

where f0 is the nominal frequency (32.768 kHz) T0 is the standard temperature (25°C) k is the parabolic coefficient of the crystal (typically 0.04 ppm/°C²) T is the ambient temperature

As shown in the frequency error versus temperature graph, the frequency slows down as the temperature deviates from room temperature (25°C).

How to make low power consumption and high efficiency accurate compensation for real-time clock
The graph shows that the frequency will slow down as the temperature deviates from room temperature. Source: Maxim Integrated

To ensure the best accuracy performance, the ambient temperature must be adjusted to around 25°C. Many indoor battery powered devices can use this RTC with an external crystal solution, saving cost and reducing power consumption.

load capacitance pull

The frequency of a crystal is affected by its load capacitor. Pierce oscillator is the most commonly used crystal oscillator circuit inside RTC. It usually consists of a crystal, an inverter and a load capacitor.

How to make low power consumption and high efficiency accurate compensation for real-time clock
There is an oscillator circuit inside the RTC.

The equivalent circuit consisting of the crystal and the load capacitor is shown in the figure below.

How to make low power consumption and high efficiency accurate compensation for real-time clock
Equivalent circuit based on crystal and load capacitor. In the circuit shown, the RCL series circuit resonates in parallel with C0 and CL. The oscillation frequency formula is as follows:

How to make low power consumption and high efficiency accurate compensation for real-time clock

Oscillation Frequency Equation

Where, R1, C1 and L1 are crystal parameters, C0 is the capacitance between crystal terminals, FL is the oscillation frequency with total effective capacitance, CT is the total effective capacitance, and C1 is in series with (CL + C0)

CT is the overall effective capacitance equation

How to make low power consumption and high efficiency accurate compensation for real-time clock

FS is the series resonant frequency of the crystal

How to make low power consumption and high efficiency accurate compensation for real-time clock

Since C0 + CL is much larger than C1, the FL formula can be approximated as

How to make low power consumption and high efficiency accurate compensation for real-time clock

The derivative of FL with respect to CL represents the change in frequency in Hz with respect to the load capacitance. Calculate the rate of change of frequency per unit capacitor by dividing the series frequency. This formula shows the frequency sensitivity for various values ​​of load capacitance CL:

How to make low power consumption and high efficiency accurate compensation for real-time clock

This formula is a good approximation only if CL is close to the specified load capacitance value. If the load capacitor deviates too much from the specified value, the oscillator may not work properly because the crystal and capacitor cannot produce a 180 degree phase shift back to the input.

To reduce cost and take up board space, many RTCs have built-in factory-trimmed load capacitors. They should closely match the specified load capacitance of the crystal. If the layout is properly designed, the frequency error at room temperature should be small. The PCB traces from the crystal to the RTC pads cause additional stray capacitance. In one type of RTC on the market, the load capacitors are trimmed to provide the best clock accuracy according to the PCB layout of the evaluation kit. In other words, the stray capacitance in the evaluation kit has been included as part of the CL.

Ageing

Aging refers to the change in the resonant frequency of a crystal over time. Aging is caused by changes in crystal quality over time due to contamination inside the crystal package. Typically, the frequency of crystals varies by a few ppm per year, with most changes occurring in the first two years.

Exposing crystals to high temperatures can speed up aging. Unfortunately, there’s very little engineers can do about burn-in other than calibrating the crystal from time to time. Some RTCs provide burn-in compensation registers for the user to manually adjust the clock frequency.

RTC with calibration registers

For applications operating in an environment where the temperature is stable but the average temperature is not 25°C, an RTC with calibration registers can be used to correct. The concept is to increment or decrement the count from the clock counter to speed up or slow down the clock. The counts required to correct the time can be calculated using the crystal frequency formula provided by the crystal supplier.

System designers can also use this RTC in conjunction with an external temperature sensor. Based on the output of the temperature sensor, the microcontroller can periodically adjust the count value. However, this approach has many disadvantages.

First, additional temperature sensors increase system cost and take up more board space. Second, the microcontroller will need to adjust the calibration registers periodically, which will add overhead to the microcontroller. Third, the crystal frequency formula may not very accurately reflect the actual temperature response of the crystal, as each crystal may be slightly different from the others, and the crystal frequency formula is only representative of typical situations. For high precision applications, this solution may not be acceptable.

TCXO as clock source

Temperature Compensated Crystal Oscillators (TCXOs) combine an oscillating crystal, temperature sensor, and digital logic in a single package. Its output frequency error is very low over the entire operating temperature range. Simply connect the output of the TCXO to the crystal input or the clock input of the RTC to drive the timing logic. This solution does not require a microcontroller to correct time, but it still suffers from board space, high cost, and higher power consumption.

RTC with integrated TCXO

By integrating a temperature sensor, crystal oscillator, load capacitor and temperature compensation circuit, a high-precision RTC can be formed. Accuracy specifications for such RTCs are typically around 5 ppm or less over the industrial -40 to 85°C or automotive -40 to 125°C operating temperature range. It saves board space, power and microcontroller resources.

As mentioned earlier, in addition to temperature, the RTC needs to understand the temperature response characteristics of the crystal in order to correct for frequency errors. This information can be obtained from the calibration process.Although crystal suppliers provide a formula to calculate typical frequencies, each
Crystal properties may vary slightly. At room temperature, a typical crystal can have errors of up to 20 ppm.

Each RTC should be individually calibrated for maximum accuracy performance. Therefore, during calibration, the frequency of the crystal is measured at several different temperature points. Obviously, the more calibration points measured, the better the matching of the measured data to the actual frequency-temperature characteristic curve.

During calibration, before each new measurement, the test engineer needs to change the temperature of the test chamber or move the wafer to another test chamber with a preset temperature. Measurements can be made once the wafer temperature has reached equilibrium. For these reasons, manufacturers do not want to perform a large number of measurements, as this would greatly increase the test time and therefore the cost of the equipment.

Design engineers often use interpolation methods to reconstruct frequency-temperature curves with limited measurement data points. Take a designer considering a second-order equation as an example:

How to make low power consumption and high efficiency accurate compensation for real-time clock

where: f is frequency, t is temperature, a, b, c are coefficients

It is close enough to the crystal’s frequency-temperature curve to meet the desired accuracy specification, so engineers can resolve the three coefficients by measuring only three data points at different temperature points. For any kind of interpolation, the error at a given data point is minimal. When the input parameter is further away from a given data point, the calculation will deviate more from the actual curve. Therefore, the measurement temperature should be separated. In this case, choosing the lowest and highest temperature is a reasonable choice.

Now, with the help of an interpolation formula and a temperature sensor, the RTC knows “exactly” how far the actual oscillator frequency is from the ideal 32.768 kHz. But how does the RTC correct the frequency? As mentioned above, using a calibration register is a possible approach, but is rarely implemented in RTCs with integrated crystals. In the above-mentioned RTC with an external resonator section, there are several factors that affect the oscillation frequency of the crystal.

One of them is the load capacitance. By manipulating the load capacitor, the temperature compensation circuit can precisely increase or decrease the oscillation frequency. An example of a variable capacitor is a simple capacitor array, plus a set of capacitors switched in parallel.

The temperature sensor consumes a lot of power compared to all other components inside the RTC. The more times the sensor is turned on, the higher the average total current of the RTC will be. How often to measure the temperature and run the compensation algorithm depends on the needs of the operating environment. Some RTCs offer the user the option to set the appropriate temperature measurement interval.

Here is an example of an RTC with an integrated TCXO and crystal. The DS3231SN has an accuracy specification that supports up to 3.5 ppm accuracy over the entire operating temperature range of -40°C to 85°C, with an error of only 2 ppm over the 0°C to 40°C range. The diagram below conveys the difference in accuracy between a TCXO and a typical crystal oscillator.

How to make low power consumption and high efficiency accurate compensation for real-time clock
The graph shows time and frequency versus temperature. A comparison of the DS3231SN with a typical crystal oscillator shows the precision gain achieved by using an RTC with an integrated TCXO.

RTC with integrated MEMS resonator

An RTC with integrated TCXO seems like a perfect solution. However, it still has some drawbacks. RTCs with integrated 32.768 kHz crystals are too bulky for wearables or other small form factor applications. The crystal supplier cannot reduce the size of the crystal because the frequency determines the size of the crystal. To further reduce the size, a different type of resonator can be used, namely an RTC with an integrated MEMS resonator.

A MEMS is a very small electromechanical device that vibrates and produces a highly stable reference frequency. Compared with traditional crystal oscillators, the new generation of MEMS is much less sensitive to temperature changes, and its mass is thousands of times smaller than that of crystals. Also, because a MEMS resonator is much lighter, it is more resilient to vibration and mechanical shock. MEMS resonators can be mounted on the IC die, so the overall package size can be nearly as small as the die size.

MEMS resonators typically consume more power than traditional crystal resonators, and designers can reduce current consumption by maximizing the impedance of the MEMS resonator to reduce power consumption. The equivalent impedance is:

How to make low power consumption and high efficiency accurate compensation for real-time clock

The impedance is highest when CL approaches 0, in which case the resonator operates near its parallel resonant frequency. It will reduce current and power consumption, however, since there is no load capacitor, there is no need to adjust the oscillation frequency for temperature compensation.

Since the output frequency of the oscillator cannot be changed by increasing or decreasing the load capacitance, designers need another method to adjust the frequency before feeding it into the RTC timing logic. One solution is to insert a fractional divider between the oscillator output and the RTC timing clock input.

Fractional divider

From an introductory digital design class, you may recall a number of ways to implement a clock divider that divides by any positive integer. The fractional divider can divide the clock by any fraction. To understand an advanced concept of how fractional dividers work, let’s look at a very simple example. Assuming the input clock is 100 Hz, the goal is to get a 1 Hz output from this 100 Hz reference clock. We can simply divide the clock by 100.

How to make low power consumption and high efficiency accurate compensation for real-time clock
A simple clock divider cannot produce an accurate output frequency between 0.999 Hz and 1.009 Hz.

What if the reference input clock changes slightly from 100 Hz to 99.9 Hz? How do we generate 1 Hz from 99.9 Hz? We know that if the divisor is 100, the output becomes 0.999 Hz; i.e. slightly slower than 1 Hz. If the divisor is 99, the output becomes 1.009 Hz, a little faster than 1 Hz. The figure below shows the overlap of the divide-by-100 and divide-by-99 clock output signals, and the ideal rising edge of the 1 Hz clock is somewhere within the gray area.

How to make low power consumption and high efficiency accurate compensation for real-time clock
The figure shows the divide-by-99 and divide-by-100 output clock operation.

Simple clock dividers cannot produce accurate output frequencies between 0.999 Hz and 1.009 Hz. The fractional divider has a control circuit to modulate the divisor so its output clock frequency can be switched between 0.999 Hz and 1.009 Hz. If the ratio between the two divider values ​​is carefully designed, the divider can theoretically produce an average of any frequency between 0.999 Hz and 1.009 Hz over time. Although each clock cycle is not exactly 1Hz, the average output clock can be very accurate over time.

Let x be the number of occurrences of the 0.999 Hz clock and y the number of occurrences of the 1.009 Hz clock. To calculate the correct ratio of occurrences of x to y, the equation can be set up in the following way:

How to make low power consumption and high efficiency accurate compensation for real-time clock

Where: x is the number of occurrences of a divide-by-100 clock cycle, y is the number of occurrences of a divide-by-99 clock cycle, TDiv_100 is a cycle of a divide-by-100 clock cycle (TDiv_100 = 100 / 99.9 Hz in this example), and TDiv_99 is a 99 The period of the divided clock period (in this example, TDiv_99 = 99/99.9 Hz), TTarget is the period of a target average clock period (in this example, TTarget = 1)

How to make low power consumption and high efficiency accurate compensation for real-time clock

By substituting all period variables: the ratio of x to y occurrence ratio to the variable. Using this equation, after a few algebraic operations, the calculated ratio of x:y is 9:1. This means that when the input clock to the fractional divider is 99.9 Hz, for every 9 divide-by-100 clocks, 1 divide-by-99 clock is inserted. Over a total of 10 clock cycles, the average frequency will be exactly 1 Hz. This 9:1 pattern will repeat continuously until the input frequency changes. As previously mentioned, the input frequency can be determined from a temperature-to-frequency transfer function or a look-up table obtained from calibration.

Maxim Integrated’s MAX31343 is the industry’s smallest RTC with an integrated resonator. It has a built-in temperature sensor and fractional divider for temperature compensation, and consumes only 970 nA. Its reliable accuracy specification over an operating temperature range of less than 5 ppm makes it suitable for a wide variety of applications, especially those where space is constrained and requires high precision and robustness, as well as the need to withstand mechanical vibration and shock.

The Links:   LM215WF3-SLL1 LTD056ET2S

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.