The 485 bus is a commonly used differential signal transmission method. It has the advantages of strong anti-interference ability, long transmission distance, and large number of nodes. It is widely used in communications, industrial automation and other fields. However, in practical applications, we may encounter a problem, which is whether the 485 bus needs to add pull-down resistors on the A and B lines, and what size of resistors are appropriate. This article will analyze and explain this issue.
How does the 485 bus work?
First, we need to understand the working principle and signal characteristics of the 485 bus. According to the RS-485 standard, the 485 bus transmits differential signals through two lines (A and B). Based on the voltage difference between the two lines, it is judged whether the current data bit is 0 or 1.
The data during 485 transmission has three states:
- When the voltage difference between A and B VAB = UA-UB is greater than +200mV, the logic output of the 485 transceiver is 1;
- When the voltage difference between A and B VAB = UA-UB is less than -200mV, the 485 transceiver output logic is 0;
- When the voltage difference between A and B VAB = UA-UB is between -200mV ~ +200mV, the 485 transceiver may output a high level or a low level, which is an uncertain state.
How to avoid uncertainty?
Under normal circumstances, we hope that the data received by the receiver can only be 0 or 1. Uncertain states cannot appear on the 485 bus. So, under what circumstances will an uncertain state occur?
There are mainly two situations:
- When the 485 bus is in idle state, all 485 transceivers are in receiving state, and no transceiver is driving the bus. At this time, since no signal source generates a differential voltage on the bus, the voltages on the A and B lines are basically equal, that is, the differential voltage is basically 0.
- When the 485 bus is in an open circuit state, that is, when a certain 485 transceiver is disconnected from the bus. At this point, since the disconnected transceiver no longer affects the bus, the differential voltage between the remaining transceivers is essentially zero.
When the 485 driver output is not enough to cause the absolute value of the voltage difference between A and B to be greater than 200mV, the 485 bus signal status can no longer reflect the driver status, and the receiver cannot recognize the correct signal.
- When the 485 bus appears in an uncertain state, it will cause communication errors or failures. For example, if a 485 transceiver thinks that it has received a data 0 signal in an uncertain state and outputs a low level to the serial port, then for UART communication, this is equivalent to a start bit (Start Bit), which will cause errors. judgment or error; if a certain 485 transceiver outputs high and low levels alternately in an uncertain state, then for UART communication, it will interfere with normal data, causing the UART receiver to receive abnormal data.
In order to prevent the 485 bus from being in an uncertain state, we analyzed these two anomalies and found that the cause of these two anomalies is that when the transceiver is in the receiving state, the AB line cannot maintain the normal voltage difference. To maintain the correct voltage difference even when the bus is idle or disconnected, we need to add pull-down resistors on the A and B lines (usually A is connected to a pull-up resistor and B is connected to a pull-down resistor) to ensure that the bus is idle Or there is a fixed differential voltage in the open circuit state. As shown below:
So, what factors do we need to consider when choosing the size of the pull-down resistor? Mainly include the following aspects:
- The pull-up and pull-down resistors should be small enough to ensure that the differential voltage in the idle or open circuit state is greater than +200mV or less than -200mV (selected according to the specific situation), thereby avoiding an uncertain state.
- The pull-up and pull-down resistors should be large enough to reduce power consumption and heat without affecting the driving capability and output voltage of the 485 transceiver.
- The pull-up and pull-down resistors should match the input impedance, terminal resistance, bus length, number of nodes and other factors of the 485 transceiver to ensure the impedance matching and signal integrity of the bus.
First, when the transceiver is in a disconnected state, the voltages of transceiver A and B are jointly determined by RU, RT, RD and RIN, that is:
Usually we use the same value for RU and RD, then the formula can be simplified to:
At this time, we assume that the chip's internal differential input resistance RIN=15kΩ, VCC=3.3V and RT=120R. We can calculate that at this time, 0Ω≤R≤239Ω. Of course, as long as R≤232.5kΩ, A and B can be satisfied in the case of disconnection. The line is in data 1 state.
For the idle state, consider that most node devices will add RU and RD resistors on the A and B lines, and add RT resistors on the terminals. As shown below:
From the previous derivation process, we know that the only difference is the increased input resistance and pull-up and pull-down resistance due to the addition of nodes, so we can derive the following formula based on the above circuit:
In this formula, m is the number of nodes with pull-down resistors, and n is the number of nodes. We define the difference between bus terminal A and terminal B as the minimum 200mA, so we can simplify this formula to:
With this formula, the value of the pull-up and pull-down resistors can be determined based on the actual number of nodes.
However, the result calculated based on this formula is only an ideal value. In actual use, the pull-up and pull-down resistors are generally determined inside the node. Different node devices may have different internal pull-up and pull-down resistors. We need to consider the number of nodes to consider the value of this resistor. To determine the value of the pull-up and pull-down resistors, you also need to consider the load capacity of the driver chip. The pull-up and pull-down resistors cannot be set very small.
In short, the 485 bus needs to add a pull-down resistor on the AB line, mainly to ensure that the bus has a fixed differential voltage in the idle or open state, thereby avoiding communication errors or failures caused by uncertain states. When selecting the size of the pull-down resistor, factors such as power consumption, driving capability, impedance matching, etc. need to be comprehensively considered to ensure the stability and reliability of communication.