【 Technical Guide 】 The most complete introduction to RS-485 design
2024-07-03 10:26:44 1072
1. Introduction
In 1983, the Electronic Industries Association (EIA) approved a new balanced transmission standard, called RS-485. The survey found that RS-485 is highly acclaimed and widely used in industrial, medical and consumer products, becoming the workaday specification for industrial interfaces.
This application report provides design guidelines for engineers who are new to the RS-485 standard to help them design robust and reliable data transmission in the shortest possible time.
2. Standards and characteristics
RS-485 is an electrical standard only. In contrast to the complete interface standard that defines functional, mechanical, and electrical specifications, RS-485 only defines the electrical characteristics of drivers and receivers using balanced multipoint transmission lines.
However, many higher level standards specify RS-485 as a reference standard, such as China's energy meter communication protocol standard DL/T645 explicitly specifies RS-485 as a physical layer standard.
Main features of RS-485:
• Balanced interface
• Single 5V power supply for multiple points
• - 7V to +12V bus common model circumference
• Up to 32 unit loads
•10Mbps maximum data rate (40 feet away)
• Maximum cable length of 4,000 feet (rate of 100kbps)
3. Network topology
The RS-485 standard recommends the use of Daisy chains to connect its nodes, also known as pool lines or bus topologies (see Figure 3-1). In this topology, the drivers, receivers, and transceivers used are connected to the main trunk via stub. The interface bus can be designed for full-duplex or half-duplex transmission (see Figure 3-2).
Figure 3-1.RS-485 bus structure
A full-duplex implementation requires two signal pairs (four wires), as well as a full-duplex transceiver with separate bus access lines for the transmitter and receiver. Full-duplex mode allows nodes to send data on one pair while receiving data on the other pair.
Figure 3-2. Full-duplex and half-duplex bus structures in RS-485
In half duplex mode, only one pair of signals is used and data is required to be driven and received at different times. Both implementations require all nodes to be controlled by directional control signals, such as driver/receiver enablement signals, ensuring that only one driver on the bus is active at any one time. Multiple drivers accessing the bus at the same time can lead to bus contention, which must be avoided by software control at all times.
4. Signal level
Rs-485-compliant drivers can provide differential outputs of up to 1.5V on 54Ω loads, while receivers that comply with the standard can detect differential inputs as low as 200mV. These two values provide sufficient margin for highly reliable data transmission, even in the case of severe attenuation of the signal from the cable and connector. This robustness is the main reason RS-485 is well suited for long-distance networking in noisy environments.
Figure 4-1. Minimum bus signal level specified by RS-485
5. Cable type
Transmission of differential signals on twisted pair is advantageous for RS-485 applications because external interference sources are equally coupled to both signal lines in common mode, and this noise is filtered out by the differential receiver.
Industrial RS-485 cable is divided into protective sleeve, no protective sleeve, twisted pair, unshielded twisted pair, in line with 22-24AWG wire gauge cable characteristic impedance of 120Ω. Figure 5-1 shows the cross section of a four-wire pair cable, an unshielded twisted pair typically used for 2 full-duplex networks. Two-pair and single-pair versions of similar cables can be used in low-cost half-duplex system designs.
Figure 5-1. Example of an RS-485 communication cable
In addition to network wiring, the RS-485 standard forces the printed circuit board layout and connectors of the device to be consistent with the electrical characteristics of the network, which can be achieved by making the two signal lines on the printed circuit board as close and equal in length as possible.
6. Bus terminal and stub length
To avoid signal reflection, the data transmission line should always be terminated and the stub should be as short as possible. Proper termination requires a match between the terminal resistance RT and the characteristic impedance Z0 of the transmission cable. The RS-485 standard recommends a Z0 = 120W cable, so the cable trunk is usually terminated with a 120 resistor, one at each end of the cable (see the left half of Figure 6-1).
Figure 6-1. Correct RS-485 terminal
Applications in noisy environments typically replace the 120Ω resistor with two 60Ω resistors to form a low-pass filter that provides additional common-mode noise filtering capability (see the right half of Figure 6-1). Be sure to match the resistance value (preferably with a 1% precision resistor) to ensure that the frequency reduction of the two filters is equal. A large resistance tolerance (i.e. 20%) results in a different filter break frequency, and common-mode noise is converted to differential noise, making the receiver less immunity.
The electrical length of the stub (the distance between the transceiver and the cable trunk) should be less than 1/10 of the driver output rise time and is determined by the following formula:
Table 6-1 lists the maximum stub length in Figure 5-1 (78% rate) corresponding to the rise time of each drive.
Drivers with long rise times are ideal for applications that require long root length and reduced EMI generated by the device.
7. Fail protection
Failure protection gives the receiver the ability to output a definite state in the absence of an input signal.
There are three possible causes of signal loss (LOS) :
1. Open: The cable is interrupted or the transceiver is disconnected from the bus
2. Short circuit: the wires of the differential pair contact together due to the failure of the insulation layer
3. Bus idle: This happens when all bus drivers are not active.
Under the above conditions, when the input signal is zero, it will make the traditional receiver output random state, and now the transceiver contains a bias circuit inside, which can protect against open, short and idle bus, even if the signal is lost, the receiver can force the output of a certain state.
The disadvantage of these fail-safe designs is that the worst-case noise tolerance is only 10mV, so in a disturbing environment, an external fail-safe circuit is added to increase the noise tolerance.
The external fail-safe circuit consists of a resistance divider that generates enough bus differential voltage to drive the receiver to produce a defined output state. To ensure adequate noise tolerance, in addition to the receiver input threshold of 200mV, the VAB must also include the maximum differential noise measured, VAB= 200mV + V noise.
When the minimum bus voltage is 4.75V, (5V - 5%), VAB = 0.25V and Z0 = 120W, RB is 528W. Inserting two 523W series resistors into the RT creates the fail-safe circuit shown in Figure 7-1.
Figure 7-1. External idle bus fail-safe bias circuit
8. Bus load
The output of the driver depends on the current it must provide to the load, so adding transceivers and fail-safe circuits to the bus increases the total load current required. To estimate the maximum number of bus loads possible, RS-485 specifies a unit load (UL) assumption that represents a load impedance of approximately 12kW. A qualified drive must be able to drive 32 of these unit loads. The transceivers used today can often reduce the unit load, such as 1/8 UL, allowing up to 256 transceivers to be connected on the bus.
The fail-safe bias can contribute up to 20 units of bus load, so the maximum number of transceivers N is reduced to:
Thus, when using 1/8-UL transceivers, up to 96 devices can be connected to the bus.
9. Data rate and bus length
At a given data rate, the maximum bus length is limited by transmission line losses and signal jitter. When the baud jitter is 10% or higher, data reliability deteriorates sharply. Figure 9-1 shows the relationship between the cable length and data rate of a traditional RS-485 cable under 10% signal jitter.
Figure 9-1. Cable length and data rate
A. Part 1 of the graph shows the high data rate area over the short cable length. Here, the loss of the transmission line can be ignored, and the data rate is determined by the rise time of the drive. Although the standard recommends a data rate of 10Mbps, today's fast interface circuits can operate at data rates of up to 40Mbps.
B. Part 2 shows the transition from short data lines to long data lines. The loss of transmission lines must be taken into account. Therefore, as the cable length increases, the data rate must decrease. As a rule of thumb, the product of the line length [m] and the data sheep [bps] should be < 10 to the 7th power. This rule is much more conservative than the performance of today's cables, and therefore, for a given data rate, its length will be less than that shown in the graph.
C. Part 3 shows a lower frequency paradigm where the line resistance (rather than the switch) limits the system length. Here, the cable resistance is close to the value of the terminal resistance. This voltage divider results in a signal attenuation of -6dB. For 120W 22 AWG cable UTP, this happens at about 1200m.
10. Minimum node spacing
The RS-485 bus is a distributed parameter circuit whose electrical characteristics are determined primarily by the inductance and capacitance distributed along the physical medium, including interconnect cables and printed circuit board tracks.
Adding capacitors to the bus in the form of devices and their interconnections reduces the bus impedance and causes a mismatch between the impedance of the medium and the load part of the bus. When the input signal reaches these positions, some of it will be reflected back to the signal source, causing distortion of the driver output signal.
To ensure that the voltage level is still active when the first signal output from the driver is transmitted to the receiver input, a minimum load impedance Z'> 0.4 x Z0 is required anywhere on the bus, which can be achieved by maintaining a minimum distance d between bus nodes:
Where CL is the lumped load capacitance and C is the medium capacitance per unit length (cable or PCB track).
Figure 10-1. Relationship between the minimum node spacing and the device and medium capacitance
Equation 4 shows the function of minimum device spacing with distributed media and lumped load capacitance. Figure 10-1 illustrates this relationship graphically.
Load capacitors come from line circuit bus pins, connector contacts, printed circuit board tracks, protection devices, and any other physical connection to the trunk. Therefore, the electrical distance from the bus to the transceiver (stub area) should be as short as possible.
The following describes the capacity values of each capacitor:
5V transceivers typically have a capacitance of 7pF, while 3V transceivers have about twice the capacitance of 16pF. The circuit board rail, depending on its structure, increases the capacitance by about 0.5 to 0.8pF per centimeter. Connectors and suppressor devices may have a wide range of capacitors. Dielectric distributed capacitance ranges from 40pF/m (low capacitance unshielded twisted pair cable) to 70pF/m (backplane).
11. Ground and isolate
When designing remote data links, designers must assume that there is a large ground potential difference (GPD). These voltage VNS are superimposed on the transmission line in the form of common-mode interference. Even if the total stack signal is within the receiver input common-model range, it is dangerous to rely on local ground as a reliable current loop (see Figure 11-1a).
Figure 11-1. Beware of design pitfalls: a) high ground potential difference, b) high loop current, c) Low loop current, but large loop ground, highly sensitive to induced noise
Since remote nodes may draw power from different parts of the electrical device, when such devices are modified (i.e., during maintenance work), the ground potential difference will exceed the receiver's input common-model range. As a result, a data link that works well today may stop working at some point in the future.
It is also recommended not to connect the remote ground directly through the ground wire (see Figure 11-1b), because large loop ground currents will be driven to the signal wire in the form of common mode noise.
In order to connect the remote ground directly, the RS485 standard recommends that the device ground be isolated from the local system ground by inserting a resistor (see Figure 11-1c). Although this method reduces the loop current, the presence of a large loop ground still makes the data link sensitive to noise generated somewhere along the loop. Therefore, until now, a robust data link has not been established.
A robust RS-485 data link method that can tolerate thousands of volts of ground potential difference and can be transmitted over long distances is signal and power supply isolation (see Figure 11-2).
Figure 11-2. Isolation of two remote transceivers with a single ground reference
In this case, a power isolator (such as an isolated DC/DC converter) and a signal isolator (such as a digital capacitor isolator) prevent current from flowing between remote systems and avoid generating loop current.
While Figure 11-2 shows the detailed connection of only two transceiver nodes, Figure 11-3 shows an example of multiple isolated transceivers. All but one transceiver accesses the bus via isolation. The non-isolated transceiver on the left provides a single ground reference for the entire bus.
Figure 11-3. Isolation of multiple fieldbus transceivers
The RS-485 standard provides a solid foundation for industrial data communication, but its design and implementation need to consider a variety of factors, including network topology, signal processing, cable selection, and grounding strategies, to ensure the stability and reliability of data transmission.