SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

With the tendering of smart meters by State Grid Corporation (hereinafter referred to as State Grid), the competition among meter manufacturers has become increasingly fierce, and the production cost has become one of their most concerned issues. Only by reducing costs can it be possible to occupy a favorable position in the low-price competition , and gradually increase profits. This puts the SoC in the spotlight.

Judging from the overall solution of the current State Grid single-phase smart energy meter, the high-cost Electronic materials are the real-time clock chip, ESAM security chip, MCU, metering chip, and LCD driver. The ESAM security chip is designated for the State Grid because of its security requirements, and does not have the conditions for integration. Although the measurement chip will eventually be integrated into the SoC chip, the State Grid is more cautious about this, and it is difficult to make a breakthrough in a short period of time. Therefore, the more pragmatic SoC solution at present is to integrate the LCD driver and the real-time clock chip. Most LCD driver IC manufacturers have similar products, and there is no technical difficulty. In terms of real-time clock, the chips used in single-phase smart meters are mainly EPSON 8025T, Intersil 12020M, and Maxim DS3231. The unit price is more than 7 yuan, the price is more expensive, but its performance index is high, within the range of -40 ℃ ~ 85 ℃ , the accuracy is better than 0.432s/d, much higher than the -25℃~60℃, 1s/d requirement of the State Grid. It is difficult, but not impossible, to achieve performance close to that of an external real-time chip in an SoC chip.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

The timing accuracy of the real-time clock mainly depends on the characteristics of the clock source and how to make a compensation mechanism according to the characteristics of the clock source. The following two aspects are briefly introduced.

Since the real-time clock chip needs to work under the condition of battery power supply, power consumption becomes a very important consideration, and a tuning fork crystal oscillator with high ESR is usually used. The accuracy of the tuning fork crystal is affected by the following aspects.

Deviations in the production process lead to a shift in the frequency at room temperature. The frequency offset is generally around ±20PPM, and the accuracy is slightly higher at ±5PPM;

Influence of temperature: This part has the greatest influence, and the frequency offset and temperature are approximately parabolic;

Aging: Crystal accuracy will change over time. In the first year, the crystal accuracy will have a maximum variation of ±3PPM, and there will be a variation of ±10PPM during the entire service life;

Influence of excitation power: Excessive excitation power will affect the accuracy and life of the clock source, so the excitation power should be controlled within the acceptable range of the crystal oscillator. For the commonly used 32768 tuning fork crystal oscillator, the excitation power should be less than 1μW;

Load capacitance: including external load capacitance and PCB stray capacitance. The effect of load capacitance on frequency is called the traction ratio and can be expressed as:

Among them, CM is the dynamic equivalent capacitance of the crystal, C0 is the static capacitance of the crystal, and CL is the external load capacitance.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

With the tendering of smart meters by State Grid Corporation (hereinafter referred to as State Grid), the competition among meter manufacturers has become increasingly fierce, and the production cost has become one of their most concerned issues. Only by reducing costs can it be possible to occupy a favorable position in the low-price competition , and gradually increase profits. This puts the SoC in the spotlight.

Judging from the overall solution of the current State Grid single-phase smart energy meter, the high-cost electronic materials are the real-time clock chip, ESAM security chip, MCU, metering chip, and LCD driver. The ESAM security chip is designated for the State Grid because of its security requirements, and does not have the conditions for integration. Although the measurement chip will eventually be integrated into the SoC chip, the State Grid is more cautious about this, and it is difficult to make a breakthrough in a short period of time. Therefore, the more pragmatic SoC solution at present is to integrate the LCD driver and the real-time clock chip. Most LCD driver IC manufacturers have similar products, and there is no technical difficulty. In terms of real-time clock, the chips used in single-phase smart meters are mainly EPSON 8025T, Intersil 12020M, and Maxim DS3231. The unit price is more than 7 yuan, the price is more expensive, but its performance index is high, within the range of -40 ℃ ~ 85 ℃ , the accuracy is better than 0.432s/d, much higher than the -25℃~60℃, 1s/d requirement of the State Grid. It is difficult, but not impossible, to achieve performance close to that of an external real-time chip in an SoC chip.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

The timing accuracy of the real-time clock mainly depends on the characteristics of the clock source and how to make a compensation mechanism according to the characteristics of the clock source. The following two aspects are briefly introduced.

Since the real-time clock chip needs to work under the condition of battery power supply, power consumption becomes a very important consideration, and a tuning fork crystal oscillator with high ESR is usually used. The accuracy of the tuning fork crystal is affected by the following aspects.

Deviations in the production process lead to a shift in the frequency at room temperature. The frequency offset is generally around ±20PPM, and the accuracy is slightly higher at ±5PPM;

Influence of temperature: This part has the greatest influence, and the frequency offset and temperature are approximately parabolic;

Aging: Crystal accuracy will change over time. In the first year, the crystal accuracy will have a maximum variation of ±3PPM, and there will be a variation of ±10PPM during the entire service life;

Influence of excitation power: Excessive excitation power will affect the accuracy and life of the clock source, so the excitation power should be controlled within the acceptable range of the crystal oscillator. For the commonly used 32768 tuning fork crystal oscillator, the excitation power should be less than 1μW;

Load capacitance: including external load capacitance and PCB stray capacitance. The effect of load capacitance on frequency is called the traction ratio and can be expressed as:

Among them, CM is the dynamic equivalent capacitance of the crystal, C0 is the static capacitance of the crystal, and CL is the external load capacitance.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

Common compensation mechanisms are divided into analog methods and digital methods

The main principle of the simulation method is to use the influence of the load capacitance on the frequency to achieve the purpose of compensating the frequency offset by increasing and decreasing the load capacitance. The advantage of this method is that the compensation is real-time, and every 32768kHz clock after compensation is accurate. However, the disadvantages are also obvious. The compensation range is limited. Too large or too small capacitance will bring stability problems. The nonlinearity of compensation and the compensation effect are related to the CM of the crystal itself, which will bring the complexity of batch adjustment.

A commonly used digital compensation mechanism is TTF (Digital Pulse Throughput Method), which compensates for timing accuracy through the number of throughput clocks. For example, for a 32768Hz clock source, it usually only needs to count 32768 pulses to output an accurate 1Hz signal, but when the oscillation frequency of the clock source increases from 32768Hz to 32769Hz, still counting 32768 pulses to output a 1Hz signal will obviously be too fast . At this time, you can output 1Hz by adding 1 pulse, that is, 32769 pulses. At this time, 1Hz is accurate. The compensation precision is 1/32768=30.5PPM. If you need to improve the compensation accuracy, there are two ways: 1) Increase the cycle time of the number of throughput pulses, such as from 1s to 60s, at this time the adjustment accuracy becomes 1/32768/60=0.51PPM, but the real-time performance is reduced; 2) Increase the frequency of the throughput pulse, such as a built-in 100 multiplier PLL circuit, the width of the increase of one pulse is only 1/100 of the original 32768Hz, and the compensation accuracy can reach 0.305PPM, but this will increase the power consumption. . The advantage of the digital compensation method is that it does not need to change the oscillator itself, the compensation range is large, and it does not bring stability problems, and the compensation effect is determined, independent of the crystal characteristics. The disadvantage is that the real-time performance and power consumption of compensation are difficult to guarantee at the same time.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

At present, the real-time clock chips on the market use a combination of analog methods and digital low-frequency clock methods to achieve balance between real-time performance and power consumption due to the power consumption of battery applications. The disadvantage is that there are many factory adjustments. However, in the specific application of smart meters, it is not necessary to output 1Hz second pulses in the case of battery power supply. At this time, the real-time requirements for correction are not high, and the low-frequency pulse compensation method can be used to meet the requirements of power consumption. In the case of mains power supply, it is required to output stable and accurate 1Hz second pulses, but the power consumption is not high at this time, so high-frequency pulses can be used for output compensation, which makes full digital compensation possible.

The method adopted in this paper is the all-digital compensation method. The system structure diagram is shown in Figure 4.

SoC smart meter solution with built-in high-precision temperature compensation hardware RTC

The system uses the SoC chip SH79F6431 tailored by Zhongying Electronics for the State Grid.

The main resources of SH79F6431 are as follows:

Working voltage 2.4V~3.6V (some IO supports 5V for PLC interface);

JTAG online debugging;

64KB FLASH program storage space;

256B IRAM, 2816 XRAM;

3-way UART interface, one built-in infrared modulation circuit;

3-way timer, 2-way PWM, can be used to generate ESAM and CPU card clock;

Hardware IIC interface, convenient to communicate with LCD and EEPROM;

Built-in 4-channel 10-bit ADC, which can directly measure battery voltage internally;

Low-power hardware real-time clock with compensation;

Built-in high-speed PLL;

Built-in power-down detection reference source, convenient and accurate to detect external power-down;

Built-in power switching circuit;

Built-in 4*39 LCD driver;

ISP is supported.

In terms of resources, SH79F6431 can fully meet the application of single-phase electric energy meter of the State Grid. What is more special is that its RTC is a hardware RTC. Its operation is independent of the CPU and is not affected by various reset circuits. It can provide two power supply modes. Under the power consumption and real-time compensation mechanism. Under the condition of ensuring the mains power supply, each second pulse is accurate and stable, and the user interface is unified, which is very simple and easy to use. The user only needs to divide the frequency deviation to be corrected by 2.03 and write it into the correction register (RTCDATA) after rounding it up. .

In Figure 4, Rref, Rntc and C1 form a temperature measuring circuit for measuring the ambient temperature of the crystal. Considering the power consumption and self-heating issues, the impedances of Rref and Rntc are relatively large. Here, Rref uses a 100kΩ/0.1% resistor, Rntc uses 50kΩ, and C1 is 1000pF, which are used to meet the ADC input dynamic resistance requirements.

The oscillator uses Seiko VT-200F and 12pF, and the capacitor should use C0G capacitor with small temperature drift.

For the various factors that affect the clock accuracy mentioned above, the compensation method is as follows:

Process and load capacitance effects:

Measure the frequency offset B (in PPM) at normal temperature (about 25°C), and write B/2.03 into RTCDATA.

Effects of aging:

According to the actual working time and aging rate of the crystal, the aging compensation value can be obtained by dividing the frequency deviation caused by aging by 2.03, and after algebraically summing it with the normal temperature compensation value and the temperature compensation value, it is written into RTCDATA and compensated once a year.

The effect of temperature:

Use the temperature measurement circuit to measure the current temperature value, and find the frequency offset A caused by the temperature effect at the corresponding temperature according to the curve of temperature and crystal frequency changing with temperature. In the whole temperature range, to compensate and meet the requirements of the State Grid, it is necessary to ensure that the temperature is controlled within ±1°C.

The temperature characteristics of crystal oscillators are not ideal parabolas, and the temperature characteristics of various manufacturers are different. A large number of temperature experiments are required to obtain the temperature characteristics, and the workload is huge. Practice has shown that drawing a point every 5 ℃ can not only ensure the accuracy, but also greatly reduce the workload.

The compensation action can be performed once a minute under the mains power supply; under the battery power supply, taking into account the power consumption, it is generally enough once every fifteen minutes. The software flow of a compensation is shown in Figure 5.

Summary of this article

The built-in RTC compensation SoC solution based on SH79F6431 is simple and easy to implement, does not require complex operations, and greatly reduces the cost of independent RTC chips. At present, the scheme has passed the batch trial production verification, and its performance can be better than the requirements of the State Grid. In the whole temperature range, it can reach ±0.3s/d. The compensation effect depends on the temperature measurement accuracy and the consistency of materials.

The Links:   SP14Q002-A1 LJ64H034 SEMIKRONIGBT