Several Ways to Improve Reliability of RS-485 Bus and Common Troubleshooting

Among the many solutions for medium and long-distance communication between MCUs, RS-485 is widely used in the fields of factory automation, industrial control, community monitoring, and water conservancy automatic detection because of its simple hardware design, convenient control, and low cost. RS-485 The 485 bus still has defects in anti-jamming, self-adaptation, communication efficiency, etc. The improper handling of some details often leads to communication failures and even system failures. Therefore, it is important to improve the operational reliability of the RS-485 bus.

1RS-485 interface circuit hardware design

1) There are two methods for bus matching and bus matching. One is to add matching resistors, and the differential ports located at both ends of the bus should be connected with 120Ω matching resistors between VA and VB to reduce the reflection and noise absorption due to mismatch. Effectively suppresses noise interference, but the matching resistor consumes a large amount of current and is not suitable for systems with strict power consumption limitations.

Another relatively power-saving matching scheme is that RC matching uses a capacitor C to cut the DC component, which can save most of the power, but the value of capacitor C is a difficult point, and there is a trade-off between power consumption and matching quality. In addition, there is a matching scheme using diodes. Although this scheme does not achieve true matching, it uses the clamping action of the diodes, quickly weakens the reflected signal to improve the signal quality, and has a significant energy saving effect.

2) RO and DI terminals are configured with pull-up resistors, and asynchronous communication data is transmitted in bytes. Before each byte is transmitted, a handshake is started with a low-level start bit, and RO is mistakenly prevented to prevent interference signals. Receiver output) generates a negative transition, so that the receiver MCU enters the receive state, it is recommended that the RO external 10kΩ pull-up resistor,

3) Ensure that the RS-485 chip is in the receive input state when the system is powered on. For the transceiver control terminal TC, it is recommended to use the MCU pin to control through the inverter. It is not appropriate to directly control the MCU pin to prevent the MCU from powering on. Bus interference,

4) Bus isolation, RS-485 bus is a parallel two-wire interface. If there is a chip failure, the bus may be "pulled to death". Therefore, the two-wire port VA, VB and bus should be isolated, usually in VA. A 4~10Ω PTC resistor is connected in series between VB and the bus, and 5V TVS diodes are connected across the ground at the same time to eliminate line surge interference, if there is no PTC resistor and TVS diode, common resistance and Regulator replacement,

5) Reasonable selection of chips, for example, external equipment In order to prevent strong electromagnetic (lightning) impact, it is recommended to use TI's 75LBC184 and other lightning protection chips, as well as the optional use of SIPEX's SP485R with a large number of nodes.

2RS-485 network configuration

1) The number of network nodes and the number of network nodes are related to the selected RS-485 chip drive capability and the input impedance of the receiver. For example, the nominal maximum value of the 75LBC184 is 64 points, the maximum value of the SP485R is 400 points, and the actual value is used. The cable length, wire diameter, network distribution, and transmission rate are different, and the actual number of nodes does not reach the theoretical value. For example, 75LBC184 works on a 500m distributed RS-485 network when the number of nodes exceeds 50 or the rate is greater than 9.6kb/s. The reliability is obviously reduced, usually the number of recommended nodes is selected according to 70% of the maximum value of the RS-485 chip, the transmission rate is selected from 1200 to 9600 b/s, the communication distance is within 1 km, and the comprehensive consideration is taken from the communication efficiency, the number of nodes, and the communication distance. When choosing the best 4800b/s and the communication distance above 1km, consider increasing the reliability of data transmission by increasing the relay module or reducing the rate.

2) The distance between the node and the trunk, theoretically, the shorter the distance between the RS-485 node and the trunk (T head, also called the lead line), the better the node with the T head less than 10 meters, and the matching of the connection to the network. Too much impact, can be used with confidence, but for the node spacing is very small (less than 1m, such as LED module combination screen) should be used star connection, if the use of T-type or beaded connection will not work, RS-485 is a kind of half Duplex structure communication bus, mostly for one-to-many communication systems, so the host (PC) should be placed at one end, not in the middle to form the backbone of the T-distribution,

3 Improve RS-485 communication efficiency

RS-485 is usually applied in a one-to-many master-slave communication system, and it is much less efficient than a full-duplex bus such as RS-232. Therefore, it is very important to select the appropriate communication protocol and control method.

1. Bus steady-state control (handshaking signal), most users choose to send and receive control terminal TC high level 1ms before data transmission, so that the bus will enter the stable transmission status before sending data; data transmission is delayed for another 1ms later TC end into a low level, so that after the completion of reliable transmission into the receiving state, according to the author of the TC-side delay has 4 machine cycles have met the requirements;

2. In order to guarantee the quality of data transmission and check each byte, the characteristic words and check words should be reduced as much as possible. The common data packet format consists of boot code, length code, address code, command code, data, and check code. The composition of the tail code, each packet length of 20 to 30 bytes, in the RS-485 system, this protocol is not concise, recommend the user to use the MODBUS protocol, the agreement has been widely used in water conservancy, hydrology, electricity and other industries equipment And the system's international standards,

4RS-485 interface circuit power supply, grounding

For the monitoring and control network formed by the MCU combined with the RS-485 micro-system, priority should be given to the independent power supply scheme of each micro-system. It is better not to use a large power supply to supply power to the micro-system in parallel, and the power line (AC/DC) cannot be connected to the RS-485 signal. Line share the same multi-core cable, RS-485 signal line should use cross-sectional area of ​​more than 0.75mm2 twisted pair instead of flat line, linear power supply for each small-capacity DC power supply LM7805 is more appropriate than the choice of switching power supply, of course, should pay attention to LM7805 protection of:

1. LM7805 input and ground should be connected to 220 ~ 1000μF electrolytic capacitor;

2. LM7805 input and output reversed 1N4007 diode;

3. LM7805 output and ground should be connected across 470 ~ 1000μF electrolytic capacitor and 104pF monolithic capacitor and reverse connection 1N4007 diode;

4. The input voltage is preferably 8~10V, and the maximum allowable range is 6.5~24V. TI's PT5100 can be used instead of LM7805 to achieve ultra-wide voltage input of 9~38V.

5 photoelectric isolation

In some industrial control areas, due to the complexity of the on-site situation and the high common-mode voltages among various nodes, although RS-485 interface uses a differential transmission mode and has a certain ability to resist common-mode interference, when When the module voltage exceeds the limit receiving voltage of the RS-485 receiver, that is, when it is greater than +12V or less than -7V, the receiver will no longer work normally. In severe cases, the chip and equipment may even be burned.

The solution to this problem is to isolate the system power supply from the power supply of the RS-485 transceiver using DC-DC; to isolate the signal by the optocoupler and completely eliminate the effects of the common-mode voltage, the way to achieve this solution can be divided into:

(1) Use optocoupler, isolated DC-DC, RS-485 chip to build the circuit;

(2) Use secondary integrated chips, such as PS1480, MAX1480, etc.

6RS-485 system common faults and processing methods RS-485 is a low-cost, easy-to-operate communication system, but weak stability and mutual containment, usually a node failure will lead to the system as a whole or partial defects, And it is difficult to judge, so introduce readers to some common methods of maintaining RS-485,

1) If the system is completely defective, it is mostly because the VA and VB of a certain node chip break down the power supply, measure the VA with a multimeter, and the differential mode voltage between VB is zero, and the common mode voltage of the ground is greater than 3V. Common-mode voltage size to check, the greater the common-mode voltage, the closer to the fault point, and vice versa;

2) The bus does not work normally for several nodes. Usually one of the nodes is faulted. One node failure will cause adjacent 2 to 3 nodes (usually follow-up) to fail to communicate, so they will be separated from the bus one by one. If the bus is recovered after a node is disconnected, it indicates that the node is faulty.

3) When a centralized power supply RS-485 system is powered up, some nodes often appear abnormal, but each time is not exactly the same. This is due to the unreasonable design of the transceiver control terminal TC of the RS-485, causing the micro system to power on. The chaotic state of the nodes causes the bus to be blocked, and the improved method is to add power switches to the micro-systems and power them up separately.

4) The system is basically normal but communication failure occurs occasionally. Generally, the system reliability is in a critical state due to irrational network construction. It is better to change the routing or increase the relay module. One of emergency methods is to replace the failed node with Better performance chips;

5) Due to MCU failure, the TC terminal is in a state of long hair and the bus is pulled to death. Remind readers not to forget to check the TC terminal. Although RS-485 specifies the differential mode voltage greater than 200mV, it can work normally, but the actual measurement: a good operation The system's differential mode voltage is generally around 1.2V (due to the network distribution, the speed difference may make the differential mode voltage in the range of 0.8 ~ 1.5V)

100mm (4 Inch) Depressed-Center Grinding Disc

B&H TOOLS CO., LTD. , https://www.bandhtools.com