What should I do if the RTC clock occasionally delays or times out?
[Copy link]
Troubleshooting 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 output by the external quartz crystal is accurate. The output frequency of the quartz crystal itself has a certain error. At room temperature of 25℃, the frequency error is ±20ppm, and the average error can reach 5 minutes/year. And as time goes by, the slow change of the crystal circuit components will cause long-term frequency drift. At the same time, when the external temperature is extreme, the clock oscillation circuit may be abnormal, affecting the normal timing of the RTC. 2. The power supply battery of the RTC chip of the industrial control board uses 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 extreme, it will change the internal chemical reaction, resulting in reduced battery life or the risk of voltage abnormality, thus affecting the normal operation of the RTC circuit. Figure 1 PCF8563 reference circuit diagram Solution To ensure high accuracy for a long time under extreme temperature, there are the following solutions: 1. Choose an RTC chip with temperature compensation, such as EPSON's RX-8025T. This chip has a built-in 32.768kHz crystal and a high-precision temperature compensation function. The output waveforms are all calibrated with temperature compensation, which can improve the stability and accuracy of the RTC. Because the embedded crystal has been treated with high-temperature aging, it has better stability than an independent crystal, and the accuracy error is less than ±5ppm in the range of -40℃ to 85℃. 2. Choose industrial-grade batteries (e.g. FANSO ER14505). Theoretically, it can work normally within the operating temperature range of -40 to 85°. The reference circuit diagram is shown in Figure 2: Figure 2 RX-8025T reference circuit diagram As shown in Figure 2, the RTC chip power supply 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 that when there is an external power supply, the RTC clock uses the VCC_3.3 power supply converted by the external power supply through the LDO, and automatically switches to the battery power supply when the external power supply stops. This ensures that the RTC chip can always work normally and prolongs the battery life. The design of this circuit is as follows: 1. Power switching circuit design From the data sheet of the RX-8025T chip, we can see that: 0)]Its 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 forward conduction characteristics of the diode can be used to automatically switch the power supply status of the system power supply and the battery power supply, so that the RTC chip can maintain normal working status. 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 first, the voltage of the system power supply after passing through the diode must be higher than the voltage of the battery after passing through the diode, so that the system power supply can work first. 0)]This can be achieved by selecting 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 supply line, and a 1N4148 diode in series on the battery power supply line; in this way, when the external power supply is used, the voltage value obtained by the system power after passing through SS14 is greater than the voltage value of the battery after passing through 1N4148, and the main power supply is used 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 [p=24, 2, 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. Calculated at a standby current of 20uA, the battery can provide power for about 15 years. However, in actual applications, it is found that after the system power supply has been powered for a long time, when it suddenly switches to battery power supply, the voltage is insufficient, resulting in abnormal RTC clock. The root cause is the passivation of the battery. 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 lithium battery power, if the lagging voltage is lower than the working voltage of the clock chip, the clock chip will completely "lose pressure", and the system clock will return to the initial time, causing the clock to work abnormally. In order to eliminate the impact of this phenomenon, we can add energy storage capacitors to the power supply of the clock chip to eliminate this impact. Figure 4 Circuit diagram of voltage hysteresis processing 3. Control the formation of passivation film The passivation film of the battery is formed when the battery is in an idle open circuit state for a long time. Then we can keep the battery in a small current discharge working state, which can slow down the speed of the passivation film formation of the battery. By selecting a suitable resistance value, the battery is in a discharge state, such as controlling the discharge current to about 20uA in standby current, so that the battery capacity is sufficient to support about 15 years, and at the same time, the passivation film will not be too thick and the voltage lag will not occur, causing the RX-8025T to completely lose power, thereby affecting the normal operation of the RTC clock. When the system power is supplied, Q1 is turned on, and a loop is formed by the battery BT1, R1, and Q1 to realize the discharge state of the battery; When the system power stops supplying, Q1 is turned off, and the battery supplies power to the RTC chip U1 through D2. The actual measurement shows that the self-discharge current of the clock chip and the internal resistance of the battery is about 8uA, so the resistance value of the resistor R1 we need to control is 3.6V/(20-8)uA=300k. Figure 5 Control passivation film circuit diagram 4. PCB design When laying out the PCB, it is important to note that the I2C trace between the RX-8052T and the MCU should be as short as possible and away from high-frequency, high-current signal traces. At the same time, the bypass capacitor should be close to the power supply terminal of the RX-8025T, and the ground copper area should be increased to prevent interference. Summary After nearly 20 years of design experience, ZLG Zhiyuan Electronics has fully guaranteed the stability of its embedded products in terms of RTC clock, power management, ESD protection circuit, and various communication interfaces. Starting from the design of 8-bit single-chip microcomputer solutions in 2001, Zhiyuan Electronics has gradually mastered the application technology of ARM7, ARM9, Cortex-A7, A8, A9, M7 and the most cutting-edge A53 and other ARM system processors, and has a full range of industrial-grade ARM core boards and industrial computers. At the same time, based on our understanding and accumulation of embedded technology, we independently developed the next-generation software development platform - AWorks real-time operating system, to help users quickly develop products based on a stable software and hardware platform. Products developed based on ZLG industrial core boards/industrial control boards have been widely used in power, rail transit, industrial sites, medical and other occasions that require more stringent product reliability, and continue to provide a complete set of industry application solutions for various industries.
|