RTC clock sporadic delay and advanced phenomenon solution

In a very warm working environment, RTC clocks have sporadic delays or timeouts. The mature RTC circuit design seems simple, but how to ensure the accuracy of the RTC clock; how to quickly locate and when there are sporadic anomalies Solve the problem; this article will share a case.

First, the case situation

The industrial control board uses NXP's PCF8563 RTC chip solution. When the R&D is done in the ambient temperature test, the RTC clock has occasional delay or advance phenomenon, so the R&D has launched a series of problem positioning.

Second, troubleshooting analysis

1. The industrial control board uses NXP's PCF8563 RTC chip solution. The solution is an external 32.768kHz quartz crystal and capacitor. The output precision of the RTC chip depends on whether the clock frequency of the external quartz crystal output is accurate. The output frequency of the quartz crystal itself has a certain error. At a normal temperature of 25 ° C, the frequency error is ± 20 ppm, and the average error is up to 5 minutes / year. And as time increases, slow changes in crystal circuit components can cause long-term frequency drift. At the same time, when the external temperature is extreme, the clock oscillation circuit may be abnormal, which affects the normal timing of the RTC.

2. The power supply battery of the industrial control board RTC chip selects the lithium manganese dioxide battery of model CR2032. The theoretical operating temperature range of the battery is -30 °C~60 °C. Similar to other lithium batteries, if the external temperature is extreme, it will change the internal chemical reaction, resulting in a decrease in battery life or a risk of voltage abnormality, thus affecting the normal operation of the RTC circuit.


Figure 1 PCF8563 reference circuit diagram

Third, the solution

Long-term high-precision guarantee at extreme temperatures, the following solutions:

1. Select an RTC chip with temperature compensation such as EPSON's RX-8025T. The chip is built-in 32.768kHz crystal with high-precision temperature compensation. The output waveforms are temperature-compensated and calibrated to improve the stability and accuracy of the RTC. Because the embedded crystal has been subjected to high temperature aging treatment, it has better stability than the independent crystal, and the accuracy error is less than ±5 ppm in the range of -40 ° C to 85 ° C.

2. Select industrial grade battery (for example: FANSO ER14505), in theory, it can work normally within the working temperature range of -40~85°. The reference circuit diagram is shown in Figure 2:


Figure 2 RX-8025T reference circuit diagram

As can be seen from Figure 2, the RTC chip operating power consists of the system VCC_3.3 power supply and battery power. This power supply circuit is designed to use the VCC_3.3 power supply converted from the external power supply via the LDO when the RTC clock is operating. When the external power supply stops supplying power, it automatically switches to the battery power supply. This will ensure that the RTC chip will work normally and at the same time extend battery life. The design of this circuit is as follows:

1) Power switching circuit design

According to the data sheet of the RX-8025T chip, the operating voltage range is 1.7V to 5.5V; the system power supply is 3.3V, and the industrial grade battery ER14505 voltage is 3.6V; the system power can be automatically switched by the forward conduction characteristic of the diode. And the power supply status of the battery power, so that the RTC chip can maintain normal working condition.

Since the system power supply voltage is 3.3V, the battery voltage is 3.6V; if the system power supply is to be used preferentially, then the voltage after the system power supply passes through the diode is higher than the voltage after the battery passes through the diode, so as to ensure that the system power supply is prioritized. jobs. It can be realized by selecting two diodes with different tube voltage drops. The forward voltage of the diode SS14 is about 0.2V, and the forward voltage of the 1N4148 is about 0.7V. Then, an SS14 diode can be connected in series on the system power line, and a 1N4148 diode is connected in series on the battery power supply line; thus, when externally supplied, the voltage value obtained by the system power supply after passing through SS14 is greater than the voltage value after the battery passes through 1N4148. At this time, the main power supply is supplied; when the external power supply stops supplying power, the circuit automatically switches to the battery power supply state.


Figure 3 power switching circuit

2) Voltage lag processing

The ER14505 battery is a lithium thionyl chloride battery with a supply voltage of 3.6V and a capacity of 2700mAh; its own capacity loss is minimal and negligible. With a standby current of 20uA, the battery can be powered for about 15 years.

However, in practical applications, it is found that after the long-term power supply of the system power supply, the voltage is insufficient when the battery is suddenly switched to the battery power supply, resulting in an abnormality of the RTC clock. The root cause is that the battery is passivated.

When the RTC chip is powered by the system power supply, the lithium battery is equivalent to an open circuit. If the battery is idle for a long time, a passivation film will be generated inside the battery, and when the lithium battery is powered, if the hysteresis voltage is lower than the clock chip. The operating voltage, then the clock chip will be completely "loss of voltage", the system clock will return to the initial time, causing the clock to work abnormally. To eliminate the effects of this phenomenon, we can eliminate this effect by adding a storage capacitor to the power supply of the clock chip.


Figure 4 voltage hysteresis processing circuit diagram

3) Control passivation film generation

The passivation film of the battery is formed because the battery is left open for a long time, so we can keep the battery in a small current discharge state, which can slow down the generation of the passivation film of the battery. By selecting the appropriate resistance value, the battery is in a discharge state. For example, the discharge current is controlled at a standby current of about 20uA, so that the battery capacity is sufficient to support for about 15 years, and the passivation film is not too thick and the voltage lag is caused to cause the RX-8025T to be completely completed. Power loss, which affects the normal operation of the RTC clock.

When the system power supply, Q1 is turned on, and the battery BT1, R1, and Q1 form a loop to realize the discharge state of the battery; when the system power supply stops supplying power, Q1 ends, and the battery supplies power to the RTC chip U1 through D2. The measured self-discharge current of the clock chip and the internal resistance of the battery is about 8uA, then the resistance of the resistor R1 that we need to control is 3.6V/(20-8)uA=300k.


Figure 5 Control passivation film circuit diagram

4) PCB design

In the PCB layout, it should be noted that the I2C trace of the RX-8052T and the MCU should be as short as possible, and away from the high-frequency, high-current signal lines. At the same time, the bypass capacitor should also be close to the power supply end of the RX-8025T, and increase the area of ​​the ground copper to prevent interference.

Fourth, summary

After nearly 20 years of design experience, Zhiyuan Electronic Embedded Products has comprehensively guaranteed product stability from RTC clock, power management, ESD protection circuit and various communication interfaces. Since 2001, Zhiyuan Electronics has started from the design of 8-bit single-chip microcomputer program, and has gradually mastered the processor application technology of ARM7, ARM9, Cortex-A7, A8, A9, M7 and the most advanced A53 and other ARM systems. It has a full range of industrial-grade ARM cores. Board and industrial computer. At the same time, based on the understanding and accumulation of embedded technology, we independently developed the next-generation software development platform-Aworks real-time operating system to help users quickly realize product development based on stable software and hardware platforms, based on ZLG industrial-grade core board/engineering board development. The products have been widely used in electric power, rail transit, industrial site, medical and other places where the reliability requirements of products are more demanding, and continue to provide a complete set of industrial application solutions for various industries.