Introduction to serial port standard for RS-232, RS-422 and RS-485

Source: Internet
Author: User
Introduction to serial port standard for RS-232, RS-422 and RS-485

1. The origin of RS-232C, RS-422 and RS-485
RS-232, RS-422 and RS-485 are serial data interface standards, initially by the Electronic Industry Association (EIA) developed and released, RS-232 released in 1962, named as EIA-232-E, as industrial standards, to ensure compatibility between products of different manufacturers. RS-422 from the Development of RS-232, it is to make up for the lack of RS-232 and proposed. In order to improve the shortcomings of short distance and low rate of RS-232 communication, a balanced communication interface is defined in RS-422 to increase the transmission rate to 10 Mb/s, the transmission distance is extended to 4000 feet (when the speed is lower than kb/s), and a maximum of 10 receivers can be connected on a balanced bus. RS-422 is a kind of single-machine transmission, multi-machine receive one-way, balanced transmission specification, named as TIA/EIA-422-A standard. In order to expand the scope of application, EIA also established RS-422 standards on the basis of RS-485 in 1983, added multi-point, two-way communication capability, that is, allow multiple transmitters to connect to the same bus, at the same time, the driving capability and conflict protection characteristics of the transmitter are added, and the common mode range of the bus is extended, which is named Tia/EIA-485-A standard. Since the proposed standards proposed by EIA are prefixed with "Rs", the above standards are still used to the RS prefix in the communication industry.
RS-232, RS-422 and RS-485 standards only regulate the electrical characteristics of the interface, and do not involve connectors, cables or protocols, on the basis of which users can establish their own high-level communication protocol. Therefore, in the video industry, many manufacturers have established a set of high-level communication protocols, either open or exclusively used by manufacturers. For example, the recorder manufacturers Sony and Panasonic on the video recorder RS-422 control protocol is different, Video Server Control Protocol is more, such as Louth, odetis Protocol is open, prolink is based on profile.
Ii. RS-232 Serial Interface Standard
At present, RS-232 is one of the most widely used serial interfaces in PC and communication industry. A RS-232 is defined as a single-ended standard that increases communication distances in low-rate serial communication. The RS-232 adopts the unbalanced transmission mode, that is, the so-called single-ended communication.
The data signal sent and received is relative to the signal location. For example, the data sent from the DTE device is 2-pin relative to 7-pin (Signal Location) When db25 connector is used, for the definition of db25 pins, see Figure 1. Typical RS-232 signals swing between positive and negative levels, while sending data, the sender drive outputs positive and negative flat at + 5 ~ + 15 V. The negative value ranges from-5 ~ -15 V level. When there is no data transfer, the online is TTL, from the beginning to the end of the data transfer, the online level from the TTL level to the RS-232 level and then return the TTL level. The typical operating level of the receiver is + 3 ~ + 12 V and-3 ~ -12 V. Because the difference between the transmission level and the receiving level is only 2 V to 3 V, the common mode suppression capability is poor. In addition, the distribution capacitor on the twisted pair wires can provide a maximum transfer distance of about 15 meters, the maximum speed is 20 kb/s. RS-232 is designed for point-to-point (that is, only one pair of receiving, sending equipment) communication, its drive load is 3 ~ 7kb. So RS-232 is suitable for communication between local devices. The following table lists the electrical parameters.
9-pin interface pin Definition
Pin 1 received Line Signal Detector
(Data carrier detect)
Pin 2 pinned ed data
Pin 3 transmit data
Pin 4 Data Terminal ready
Pin 5 signal ground
Pin 6 data set ready
Pin 7 request to send
Pin 8 clear to send
Pin 9 ring indicator
Iii. Serial Interface Standard for RS-422 and RS-485
1. Balanced Transmission
RS-422, RS-485 and RS-232 is not the same, the data signal using differential transmission mode, also known as balanced transmission, it uses a pair of twisted pair, the first line is defined as a, the other line is defined as B, 2.
Normally, the power plane between drive a and drive B is equal to + 2 ~ + 6 V is a logical state with a negative level ranging from-2 ~ 6 V is another logical state. Another signal C, there is a "enable" side in the RS-485, and in the RS-422 this is available can be used. "Enable" RS-422, RS-485 and RS-232 is not the same, the data signal using differential transmission, also known as balanced transmission, it uses a pair of twisted pair, the first line is defined as, the second line is defined as B, 2.
Normally, the power plane between drive a and drive B is equal to + 2 ~ + 6 V is a logical state with a negative level ranging from-2 ~ 6 V is another logical state. Another signal C, there is a "enable" side in the RS-485, and in the RS-422 this is available can be used. The enable end is used to control the disconnection and connection between the transmission drive and the transmission line. When the enable device acts, the sending drive is in a high-impedance state, called the "third State", that is, it is a third State different from the logic "1" and "0.
The receiver is also set to correspond to the sending end. The receiving and sending end are connected to the BB through the balanced twisted pair. When there is more than 200mV power between the receiving end AB, positive logic level. If the value is less than-200mV, the negative logic level is output. The level range of the receiver receiving balancing line is usually between 200mV and 6 v. See figure 3.

2. RS-422 electrical Regulations
The RS-422 standard stands for the electrical characteristics of the balanced voltage digital interface circuit, which defines the characteristics of the interface circuit. Figure 5 is a typical RS-422 4-line interface. There is actually a signal ground line, a total of five lines. Figure 4 shows its DB9 connector pin definition. Since the receiver adopts a high input impedance and a transmission drive with a stronger drive capability than RS232, multiple receiving nodes can be connected over the same transmission line, and up to 10 nodes can be connected. That is, a master device, the rest is the slave device (Salve), the slave device cannot communicate, so the RS-422 supports two-way communication to multiple. The input impedance of the receiver is 4 kb, so the maximum load capacity of the receiver is 10 × 4 kb + 100 Ω (final resistance ). RS-422 4-line interface because of the use of a separate transmission and receiving channel, so do not control the direction of data, any necessary signal exchange between the device can be in the form of software (Xon/xoff handshake) or hardware (a pair of individual twisted pair wires.

The maximum transmission distance of the RS-422 is 4000 feet (about 1219 meters), and the maximum transmission rate is 10 Mb/s. The length of the balanced twisted pair is inversely proportional to the transmission rate. The maximum transmission distance can be reached only when the transmission rate is below kb/s. The maximum transmission rate can be obtained only within a short distance. Generally, the maximum transmission rate of a 100-meter twisted pair is only 1 Mb/s.

RS-422 needs a final resistance, the resistance value is equal to the characteristic impedance of the transmission cable. When the moment distance is transmitted, the final resistance is not required, that is, the final resistance is generally less than 300 meters. The final resistance is connected to the far end of the transmission cable. The related electrical parameters of RS-422 are shown in Table 1
RS232 interface pin Definition
25-pin interface definition:
Pin 1 protective ground
Pin 2 transmit data
Pin 3 pinned ed data
Pin 4 request to send
Pin 5 clear to send
Pin 6 data set ready
Pin 7 signal ground
Pin 8 encoded ed Line Signal Detector
(Data carrier detect)
Pin 20 Data Terminal ready
3. RS-485 electrical Regulations
Because the RS-485 is developed from the basis of the RS-422, so many RS-485 electrical regulations and RS-422 is similar. For example, the balanced transmission mode is adopted, and the final resistance must be connected to the transmission line. The RS-485 can adopt two-line and four-line mode, two-line can realize real multi-point bidirectional communication, see Figure 6.
The use of four-line connection, and the RS-422 can only achieve Point-to-many communication, that is, only one master (master) device, the rest is from the device, but it is better than the RS-422, 32 more devices can be connected to the 4-wire or 2-wire connection bus. See Figure 7.

The difference between RS-485 and RS-422 is also that the common mode output voltage is different, the RS-485 is-7 V to + 12 V, and the RS-422 is between-7 V to + 7 V, the minimum input impedance of the RS-485 receiver for the 12 K Jian S-422 is 4 K Jian; the old gorge tip Yun Yi S-485 meets the specifications of all RS-422, so the RS-485 driver can be used in the RS-422 network.
Like the RS-485, the maximum transmission distance is about 1219 meters and the maximum transmission rate is 10 Mb/s. The length of the balanced twisted pair is inversely proportional to the transmission rate. The maximum cable length can be used only when the speed is below kb/s. The maximum transmission rate can be obtained only within a short distance. Generally, the maximum transmission rate of 100-meter long twisted pair wires is only 1 Mb/s.
The RS-485 requires two final resistance, and the resistance value must be equal to the characteristic impedance of the transmission cable. When the moment distance is transmitted, the final resistance is not required, that is, the final resistance is generally less than 300 meters. The final connection resistor is connected to both ends of the transmission bus.
4. network installation points of RS-422 and RS-485
The RS-422 supports 10 nodes and the RS-485 supports 32 nodes, So multiple nodes constitute a network. Generally, the network topology adopts a bus-type structure that matches the terminal, and does not support ring or star networks. Pay attention to the following points when building a network:
1. A twisted pair cable is used as the bus to connect each node. The length of the egress from the bus to each node should be as short as possible, so that the reflected signal in the egress has the lowest impact on the bus signal. Figure 8 shows some common error connection methods (A, C, E) and correct connection methods (B, d, f) in actual applications ). Although the three network connections A, C, and E are incorrect, they may still work normally at short distance and low speed. However, as the communication distance is prolonged or the communication speed increases, the negative effects will become more and more serious, mainly because the signal is superimposed with the original signal after the signal is reflected at the end of each branch, which will cause the signal quality to decline.
2. Attention should be paid to the continuity of the impedance of the bus characteristics, and signal reflection will occur at the impedance discontinuous points. The following situations are prone to this kind of continuity: different segments of the bus use different cables, or there are too many receivers installed together on a certain bus, in addition, long branch lines are routed to the bus.
In short, a single, continuous signal channel should be provided as the bus.

Figure 8
5. Description of matching between RS-422 and RS-485 Transmission Line
RS-422 and RS-485 bus network usually need to use the final resistance for matching. However, you do not need to consider Terminal Matching at short distance and low speed. So under what circumstances do we not need to consider matching? Theoretically, when sampling at the midpoint of each received data signal, matching is not considered as long as the reflected signal degrades to a low enough value at the start of sampling. But this is actually hard to grasp. Article An empirical principle can be used to determine the desired data rate and cable length to match: when the signal conversion time (increase or decrease time) if the time required for one-way transmission of electrical signals exceeds three times the time required for one-way transmission along the bus, no matching is allowed. For example, the maximum increase or decrease time of the output signal of the RS-485 interface max483 with finite slope characteristics is 250ns, and the signal transmission rate on the typical twisted pair is about 0.2 m/NS (24awg PVC cable ), as long as the data speed is less than kb/s, the cable length does not exceed 16 meters, using max483 as the RS-485 interface can be without Terminal Matching.
General Terminal Matching Using the Method of the final resistance, as mentioned above, RS-422 in the bus cable remote joint resistance, RS-485 should be in the bus cable at the beginning and end need to be connected to the final resistance. The final resistance is generally 100 Ω in the RS-422 network, and 120 Ω in the RS-485 network. It is equivalent to the resistance of the characteristic impedance of the cable, because the Characteristic Impedance of most twisted pair cables is about 100 ~ 120 Ω. This matching method is simple and effective, but there is a drawback that the matching resistance consumes a lot of power and is not suitable for systems with strict power consumption restrictions.
Another power-saving matching method is RC matching, 9. Using a capacitor C to cut off the DC component can save most of the power. However, the value of capacitor C is a challenge, and the compromise between power consumption and matching quality is required.
There is also a matching method using diodes, 10. Although this solution does not achieve true "matching", it uses the clamp action of the diode to quickly weaken the reflected signal and improve the signal quality. The energy saving effect is remarkable.


6. grounding problem of RS-422 and RS-485
The grounding of electronic systems is very important, but it is often ignored. Improper grounding may cause the electronic system to fail to work stably or even endanger the system security. The grounding of RS-422 and RS-485 transmission network is also very important, because the unreasonable grounding system will affect the stability of the entire network, especially in the harsh working environment and the distance of transmission, more stringent requirements for grounding. Otherwise, the interface damage rate is high. In many cases, when connecting the RS-422 and RS-485 communication links, simply use a pair of twisted pair to connect the "a" and "B" ends of each interface. While ignoring the signal-ground connection, this connection method works normally in many occasions, but it has hidden dangers. There are two reasons:
1. common Mode Interference problem: As mentioned above, both RS-422 and RS-485 interface adopt differential transmission signal mode, and do not need to detect the signal relative to a reference point, the system only needs to detect the potential difference between two lines. But people often ignore the transceiver has a certain common mode voltage range, such as RS-422 common mode voltage range is-7 ~ + 7 V, while RS-485 transceiver common mode voltage range is-7 ~ + 12 V. The entire network can work normally only when the above conditions are met. When the common mode voltage in the network line exceeds this range, the communication stability and reliability will be affected, and even the interface will be damaged. Taking figure 11 as an example, when sending data from drive a to receiver B, the output Common Mode Voltage of drive a is vos. Because the two systems have their own independent grounding systems, there is a potential difference vgpd. Then, the common mode voltage VCM at the receiver input end will reach VCM = vos + vgpd. Both RS-422 and RS-485 standards stipulate vos ≤ 3 V, but vgpd may be very large (dozens of volts or even dozens of volts), and may be accompanied by a strong interference signal, as a result, the common-mode input VCM of the receiver exceeds the normal range and interference current is generated on the transmission line. Otherwise, normal communication is affected. Otherwise, the communication interface circuit is damaged.

Figure 11
2. (EMI) Problem: the common mode part of the output signal of the sending Drive requires a return path. If there is no low-resistance return channel (signal location), it will return the source end in the form of radiation, the whole bus emits electromagnetic waves outward like a huge antenna.
For the above reason, RS-422, RS-485 although using differential balanced transmission, but the entire RS-422 or RS-485 network, must have a low resistance signal ground. A low-resistance signal is used to connect the two interfaces, so that the common-mode interference voltage (vgpd) is short-circuited. This signal can be an additional line (unshielded twisted pair wires) or a shielded layer of twisted pair wires. This is the most common grounding method.
It is worth noting that this method is only effective for high-impedance common-mode interference. Due to the large internal resistance of the interference source, great grounding loop current will not be formed after transient connection, which will not have a great impact on communication. When the internal resistance of the common mode interference source is low, a large loop current will be formed on the ground, affecting normal communication. The author believes that the following three measures can be taken:
(1) If the internal resistance of the interference source is not very small, you can add a throttling resistor to the grounding wire to limit the interference current. The increase of Grounding Resistance may increase the common mode voltage, but normal communication will not be affected as long as the control is within the appropriate range.
(2) Use float technology to cut off the grounding loop. This is a commonly used and very effective method. When the common mode interference internal resistance is very small, the above method is no longer effective, at this time, you can consider floating the introduced interference nodes (such as the on-site equipment in a harsh working environment) (that is, the system circuit is isolated from the chassis or the ground ), in this way, the grounding loop is cut off without generating a large loop current.
(3) Use an isolation interface. In some cases, for safety or other considerations, the circuit must be connected to the chassis or the earth and cannot be suspended. In this case, an isolation interface can be used to cut off the grounding circuit, however, there should still be a ground line that connects the public end of the isolation side to the Work Location of other interfaces. See Figure 12.

Figure 12
7. Network Failure Protection of RS-422 and RS-485
Both RS-422 and RS-485 standards specify the receiver threshold as ± 200mV. This provision can provide a relatively high noise suppression capability. As mentioned above, when the receiver a level is higher than the B level and more than 200mV, the output is positive logic, and vice versa, the output is negative logic. However, because of the existence of the third State, that is, after the host sends an information data, it places the bus in the third State, that is, when the bus is idle, there is no signal to drive the bus, make the voltage between AB to-200 ~ + 200mV until it tends to be 0 V, which brings about a problem: the output status of the receiver is uncertain. If the output of the receiver is 0 V, the slave machine in the network will interpret it as a new starting bit and try to read the subsequent bytes, because there will never be a stop bit, A frame error is generated, and no device requests to the bus are sent. The network is paralyzed. In addition to the absence of the aforementioned bus, which may cause a two-wire electrical pressure difference of less than 200mV, this also occurs when the open or short circuit occurs. Therefore, some measures should be taken to prevent the receiver from being uncertain.
Figure 13
The offset is usually added to the bus. When the bus is idle or open, the bus is bias in a fixed state by using the offset resistance (Differential Voltage ≥-200mV ). 13. Pull a to the ground and B to 5 V. The typical resistance value is 1 kb. The specific value varies with the capacitance of the cable. The above method is a classic method, but it still cannot solve the problem of short-circuit bus. Some manufacturers can solve this problem by moving the receiving threshold to-200mV/-50mV. For example, Maxim's max3080 series RS-485 interface not only saves the external offset resistance, but also solves the problem of failure protection in the case of short-circuit bus.
8. Transient Protection of RS-422 and RS-485
The above-mentioned signal grounding measures only protect low-frequency common-mode interference and are powerless for transient interference with high frequencies. Because the transmission line is equivalent to inductance for high-frequency signals, for high-frequency transient interference, the ground line is actually equivalent to open circuit. Although the transient interference lasts for a short time, there may be hundreds of volts.
In the actual application environment, there is still the possibility of high-frequency transient interference. Generally in switching high-power inductive load such as motor, transformer, relay or lightning process will produce a very high degree of transient interference, if not properly protected will damage the RS-422 or RS-485 communication interface. Transient interference can be protected by isolation or bypass.
1. Isolate protection methods. In fact, this scheme transfers the transient high voltage to the electrical isolation layer of the isolation interface. Due to the high insulation resistance of the isolation layer, there will be no damage to the surge current, which can protect the interface. High-frequency transformer, photocoupler and other components are usually used to achieve electrical isolation of interfaces. Existing device manufacturers integrate all these components into an IC, which is very easy to use, such as max1480/max1490 of Maxim, the isolation voltage can reach 2500 V. The advantage of this solution is that it can withstand transient interference with high voltage and long duration, and is easy to implement. The disadvantage is that the cost is high.
2. Bypass protection method. This solution uses transient suppression elements (such as TVs, mov, and gas discharge tubes) to bypass harmful transient energy to the earth. The advantage is that the cost is low, and the disadvantage is that the protection capability is limited, it can only protect transient interference within a certain amount of energy, and the duration cannot be long. Moreover, it is difficult to implement it by having to have a good channel to connect the earth. In practical application, the above two solutions are combined for flexible use, 14. In this method, the isolation interface isolates large transient interference, while the bypass element protects the isolation interface from high transient voltage breakdown.

Figure 14
IX. Wiring description
1. Description of common signal ports of DB9 and db25
9-pin serial port (DB9) 25-pin serial port (db25)
PIN number Function Description
1. Data Carrier Detection DCD 8. Data Carrier Detection DCD
2 receive data rxd 3 receive data rxd
3 send data txd 2 send data txd
4. Prepare the DTr 20 data terminal for the DTr
5 signal ground Gnd 7 signal ground Gnd
6 data equipment ready DSR 6 Data ready DSR
7. Send the RTS 4 request to send the RTS
8. Clear sending CTS 5. Clear sending cts
9. The ringing command is Dell 22. The ringing command is Dell.
2. rs232c Serial Communication Connection method (three-line)
First, as long as there are receive data pins and send pins for data transmission through the serial port, the receiving pin and sending pin of the same serial port can be directly connected by a line, connect two or more serial ports
& #8226; the receiving pin and sending pin of the same serial port are directly connected to the 9-pin serial port and the 25-pin serial port, both of which are directly connected to 3 and 2;
& #8226; two different serial ports (either the two serial ports of the same computer or the serial ports of different computers)
9-9-25-25-9-25
2 3 3 2 2 2
3 2 2 3 3
5 5 7 7 5 7
The above table is for the standard serial port of the microcomputer, and there are many non-standard devices, such as receiving GPS data or electronic compass data, as long as you remember one principle: receiving data pins (or wires) it is connected to the data transmission pin (or wire). If the signal is connected to each other, the system will be able to win a hundred battles.
3. Notes for serial port debugging:
& #8226; different encoding mechanisms cannot be mixed. For example, rs232c cannot be directly connected to the rs422 interface. Specialized converters on the market can only be connected through converters;
& #8226; line welding should be solid, otherwise Program No problem, but it is wrong because of wiring problems;
& #8226; Prepare a handy debugging tool for serial port debugging, such as serial port debugging assistant and serial port genie, to get twice the result with half the effort;
& #8226.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.