What is RS485

RS485 is a communication protocol widely used in industrial control, power communication, intelligent instrumentation and other industries. RS is the abbreviation of Recommended Standard. RS485 is a serial communication interface standard released by the Electronic Industries Association (EIA) in 1983. It was revised by the Telecommunications Industry Association (TIA) and named TIA/EIA-485-A. RS-485 is an optimization and improvement based on the shortcomings of RS232. RS485 has the following advantages:

  1. Low interface level. The half-duplex network composed of RS485 interface is generally a two-wire system. The voltage difference between the two lines is + (2~6V) for logic "1", and the voltage difference between the two lines is - (2~6)V for logic "0". The interface signal level is lower than that of RS232, which makes the chip of the interface circuit less likely to be damaged. At the same time, it is compatible with TTL level and is easy to connect with TTL circuit.
  2. Fast transmission rate and long transmission distance. The fastest data transmission rate of RS485 can reach 10Mbps, and at 1200m, the transmission rate can reach 100Kbps.
  3. Strong anti-interference ability. RS485 adopts a combination of balanced driver and differential receiver, which greatly enhances its anti-common mode interference ability, can effectively resist electromagnetic interference and lightning interference, and is particularly suitable for ensuring the stability of communication in industrial environments. At the same time, it also has a low-noise receiver output, which can further reduce the bit error rate.
  4. Supports many nodes. Generally supports 32 nodes, and individual customized 485 chips can support 128 or even 256 nodes.

RS485 communication precautions

Before troubleshooting common RS485 communication problems, the following measures should be taken to effectively reduce communication failures:

Communication distance

Equipment Quantity

Equipment Quantity

 

 

 

2400/4800BPS

1-400M

1~32

0.5mm²

400-800M

1~16

0.5mm²

400-800M

17~32

0.75mm²

800-1200M

1~8

0.5mm²

800-1200M

9~21

0.75mm²

800-1200M

22~32

1.0mm²

  1. Pay attention to the communication distance, number of devices, and specifications of the communication line
  2. RS485 communication lines generally use twisted shielded wires. To ensure good anti-interference effect, the shielding layer is best connected to the ground.
  3. If the load is too much, it is recommended to use 485HUB to increase the driving capacity; if the communication distance is very long, a repeater can be used to solve the problem.
  4. All ground wires connected to 485 devices must be connected to the ground with one wire to avoid the potential difference affecting the communication between devices.
  5. The 485 bus should adopt a hand-in-hand structure, not a star structure, to avoid the generated reflected signal interfering with the communication.
  6. The characteristic impedance of most twisted pair cables is 100~140 ohms, so a 120 ohm resistor should be added at the very beginning and end of RS485 to prevent impedance mismatch at the end of the transmission line from causing signal reflection.
  7. The RS485 communication line should be routed away from high-voltage and high-current power lines.

Common RS485 Problems and Solutions

  1. RS485 received data is garbled

The oscilloscope can be used to monitor and display the waveform during the communication process. The communication status can be determined by the frequency, amplitude and shape of the transmitted waveform to quickly troubleshoot the cause of the fault:

1) Whether the detected waveform frequency is consistent with the sending frequency.

  1. Check whether the baud rate setting of the serial port assistant is consistent with the baud rate of the program serial port.
  2. Consider whether there is a problem with the clock, and check whether the crystal oscillator used on the circuit board has the same frequency as the crystal oscillator of the recommended circuit.
  3. Use a multimeter to measure whether the resistance value between the terminal pins AB of the RS485 transceiver chip is 120 ohms. It is particularly important to note that some USB to RS485 modules have 120 ohm resistors added to the terminal pins. If a 120 ohm resistor is added to the AB pins of the RS485 transceiver chip terminal, the impedance mismatch will cause data abnormalities. At this time, a 120 ohm resistor needs to be removed.

2) The detected waveform frequency is consistent with the transmission frequency, but there are non-square wave components or non-differential transmission.

It may be that the communication line itself has insufficient anti-interference ability. Solution:

  1. Check whether the shielding layer of the RS485 twisted pair is grounded.
  2. Check whether there is strong electromagnetic interference near the RS485 communication line. Isolation protection measures need to be added or stay away from the interference source.
  3. Is the baud rate too high? Appropriately reduce the baud rate to see if the signal is optimized and reduce the impact of the distributed capacitance of the cable on the signal.
  4. The receiver still has data output when the RS485 stops communicating

When the data transmission is completed, the bus is in a passive drive state, and the differential level between AB is 0; when there is no terminal, the bus is in a high impedance state. When the external noise voltage is higher than the signal threshold of ±200mV, the receiver outputs invalid data.

This problem can be solved by hardware or software. The solution is:

1) Use pull-up at the A end of the communication bus and pull-down at the B end to ensure that the receiver output is a fixed high level.

2) Add several start synchronization bytes to the communication data packet. Data communication transmission must be started after synchronization.