“In a very warm working environment, occasional delays or timeouts occur in the RTC clock. The mature RTC Circuit design seems simple, but how to ensure the accuracy of the RTC clock; how to quickly locate and control the RTC clock when occasional abnormal phenomena occur Solve the problem; this article will share a case.
In a very warm working environment, occasional delays or timeouts occur in the RTC clock. The mature RTC circuit design seems simple, but how to ensure the accuracy of the RTC clock; how to quickly locate and control the RTC clock when occasional abnormal phenomena occur Solve the problem; this article will share a case.
1. Case situation
The industrial control board uses NXP’s PCF8563 RTC chip solution. During the development and testing of the ambient temperature, the RTC clock experienced occasional delays or advances, so R&D launched a series of problem positioning.
Two, investigation and analysis
1. The industrial control board uses NXP’s PCF8563 RTC chip solution, which is an external 32.768kHz quartz crystal and capacitor. The output accuracy 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 ±20ppm, and the average error can reach 5 minutes/year. And as time increases, the slow change of crystal circuit components will cause long-term frequency drift. At the same time, when the external temperature is extreme, the clock oscillation loop may be abnormal, which affects the normal timing of the RTC.
2. The power supply battery for the RTC chip of the industrial control board is a lithium manganese dioxide battery of model CR2032. The theoretical operating temperature range of the battery is -30℃~60℃. Similar to other lithium batteries, if the external temperature is more extreme, it will change its internal chemical reaction, resulting in a decrease in battery life or the risk of abnormal voltage, thereby affecting the normal operation of the RTC circuit.
Figure 1 PCF8563 reference circuit diagram
Three, the solution
Long-term high accuracy guarantee under extreme temperature, there are the following solutions:
1. Choose RTC chip with temperature compensation such as EPSON RX-8025T. This chip has a built-in 32.768kHz crystal with high-precision temperature compensation. The output waveforms are all temperature-compensated and calibrated, which can improve the stability and accuracy of the RTC. Because the embedded crystal has undergone high temperature aging treatment, it has better stability than the independent crystal, and the accuracy error is less than ±5ppm in the range of -40℃~85℃.
2. Choose industrial-grade batteries (for example: FANSO ER14505), which can work normally within the operating temperature range of -40~85° in theory. The reference circuit diagram is shown in Figure 2:
Figure 2 RX-8025T reference circuit diagram
It can be seen from Figure 2 that the working power supply of the RTC chip consists of two parts: the system VCC_3.3 power supply and the battery power supply. The design purpose of this power supply circuit is to use the VCC_3.3 power supply converted from the external power supply via LDO when the RTC clock is powered by an external power supply. When the external power supply stops supplying power, it will automatically switch to the battery power supply. This can ensure that the RTC chip can always work normally, and at the same time can extend the 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 battery ER14505 voltage is 3.6V; the system power supply can be automatically switched through the forward conduction characteristic of the diode And the power supply status of the battery power supply, so that the RTC chip can maintain the normal working state.
Since the system power supply voltage is 3.3V and the battery voltage is 3.6V; if the system power supply is to be used preferentially, then the voltage of the system power supply after the diode must be higher than the voltage of the battery after the diode, so as to ensure that the system power is given priority Work. This can be achieved by choosing two diodes with different tube voltage drops. The forward voltage of diode SS14 is about 0.2V, and the forward voltage of 1N4148 is about 0.7V. Then you can connect a SS14 diode in series on the system power line and a 1N4148 diode in series on the battery power supply line; so when external power is supplied, the voltage value of the system power after SS14 is greater than the voltage value of the battery after 1N4148 , It is powered by the main power supply at this time; 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 hysteresis 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 extremely small and can be ignored. If the standby current is 20uA, the battery can supply power for about 15 years.
However, in practical applications, it is found that after the system power supply has been supplied for a long time, the voltage is insufficient when the battery is suddenly switched to power supply, which causes the RTC clock to be abnormal. 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 idle open circuit. If the battery is idle for too long, a passivation film will be generated inside the battery. When switching to the lithium battery power supply, if the lagging voltage is lower than the clock chip The clock chip will be completely “lost” and the system clock will be restored to the initial time, causing the clock to work abnormally. In order to eliminate the influence of this phenomenon, we can eliminate this influence by adding energy storage capacitors to the power supply of the clock chip.
Figure 4 Voltage hysteresis processing circuit diagram
3) Control the formation of passivation film
The passivation film of the battery is formed because the battery is idle for a long time, so we can keep the battery in a low current discharge state, which can slow down the speed of the passivation film of the battery. By choosing a suitable resistance value, the battery is discharged. For example, the discharge current is controlled at a standby current of about 20uA, so that the battery capacity is sufficient for about 15 years, and at the same time, the passivation film will not be too thick and the voltage lag will cause the RX-8025T to be completely The phenomenon of power failure affects the normal operation of the RTC clock.
When the system power is supplied, Q1 is turned on, and the battery BT1, R1, and Q1 form a loop to realize the discharging state of the battery; when the system power supply stops, Q1 is cut off, and the battery supplies power to the RTC chip U1 through D2. The actual self-discharge current of the clock chip and battery internal resistance is about 8uA, so the resistance of the resistor R1 we need to control is 3.6V/(20-8)uA=300k.
Figure 5 Circuit diagram of control passivation film
4) PCB design
When PCB layout, it should be noted that the I2C traces between RX-8052T and MCU should be as short as possible, and should be far away from high-frequency and high-current signal lines. At the same time, the bypass capacitor should be close to the power terminal of RX-8025T, and the copper area of the ground wire should be increased to prevent interference.
After nearly 20 years of experience in designing embedded products, ZHIYUAN Electronics fully guarantees product stability in terms of product RTC clocks, power management, ESD protection Circuits, and various communication interfaces. ZHIYUAN Electronics started from the 8-bit microcontroller program design in 2001, and gradually mastered ARM7, ARM9, Cortex-A7, A8, A9, M7 and the most cutting-edge A53 processor application technology of the ARM system. 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 research and develop the next-generation software development platform-Aworks real-time operating system to help users quickly realize product development based on a stable software and hardware platform, based on ZLG industrial-grade core board/industrial control board development Products have been widely used in power, rail transit, industrial sites, medical and other occasions where product reliability requirements are more stringent, and continue to provide a complete set of industry application solutions for various industries.