21.01.2021

Physical interfaces RS485 and RS422. MAXIM transceivers for industrial interfaces - an overview of new products Specifically about different protocols


The EIA RS232C interface is designed for serial communication of two
devices. It is generally accepted and widely used in hardware complexes with
connecting external equipment to a personal computer. Interface
RS/232C provides for the use of "single-ended" transmitters and
receivers, while data transmission is carried out using "asymmetric"
signal along two lines - TxD and RxD, and the signal amplitude is measured relative to the line
GND ("zero"). The logical unit corresponds to the range of amplitude values
signal (voltage) from -12 to -3 V, logic zero - from +3 to +12 V. Range from
–3 to +3 V corresponds to the dead zone, which determines the hysteresis of the receiver.
The asymmetry of the signal causes a low noise immunity of this
interface, especially with industrial interference. Availability of receive (RxD) and transmit lines
(TxD) data allows you to support full duplex transmission of information, i.e.
information can be both transmitted and received at the same time.

Advantages - simplicity.

Disadvantages - only one device is connected to one port, the signal transmission range without additional gadgets is only a few meters

The most widely used hardware method for data flow control
management. For correct data transmission, the receiver must be in
state of readiness to receive information. At hardware way management
the RTS/CTS signal is used, which allows you to stop data transmission if
the receiver is not ready to receive them. Hardware flow control provides the most
fast response of the transmitter to the state of the receiver.
When designing industrial automation systems, the greatest
widespread information networks based on interface standard
EIA RS485. Unlike RS/232, this interface provides data transfer with
using a "balanced" (differential) signal on two lines (A and B)
(see figure) and using an additional line for potential equalization
grounding devices connected to the RS/485 network. Logic signal level
is determined by the voltage difference on the lines (A - B), while the logical unit
corresponds to the range of voltage values ​​from +0.2 to +5 V, and to logical zero - the range
values ​​from -0.2 to -5 V. The range from -0.2 to +0.2 V corresponds to the dead zone
receiver. When using this interface, the maximum length of the communication line between
extreme devices can be up to 1200 m. At the same time, in the most remote
from each other network points it is recommended to install terminating resistors
(terminators), which allow compensating the wave impedance of the cable and
minimize the amplitude of the reflected signal.

The resistance of the terminating resistors depends on the length of the line and the number of devices. It should be between 100 and 620 ohms.

Both of these interfaces support asynchronous transfer mode. Data
are sent in blocks (frames), the format of which is shown in Fig. 1.2. Transfer of each
frame begins with a start / bit signaling the receiver about the start of transmission, after
followed by data bits and a parity bit. Terminates the sending of a stop/bit that guarantees
pause between messages.
For asynchronous mode, a number of standard exchange rates have been adopted: 50, 75, 110, 150,
300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 bps. Number of data bits
may be 5, 6, 7, or 8 (5/ and 6/bit formats are not widely used).
The number of stop/bits can be 1, 1.5, or 2 (“one and a half bits” means only
stop interval).

The serial interface uses one signal line to transmit data in one direction, along which information bits are transmitted one after another - sequentially.

Starting from the first models in the PC, there was a serial interface (English "Serial Interface") - COM-port (English "Communications port"). This port provides asynchronous communication according to the RS-232 standard. COM ports are implemented on chips of universal asynchronous transceivers (eng. "UART"). They occupy 8 adjacent 8-bit registers and can be located at standard base addresses 3F8h (COM1), 2F8h (COM2), 3E8h (COM3), 2E8h (COM4). Ports can generate hardware interrupts IRQ4(usually used for COM1 and COM3) and IRQ3(for COM2 and COM4). From the outside, the ports have serial data lines for transmitting and receiving, as well as a set of control and status signals that comply with the RS-232C standard. The COM ports have external DB-25P or DB-9P male connectors, brought to the rear panel of the computer. A characteristic feature of the interface is the use of non-TTL signals - all external signals of the port are bipolar. There is no galvanic isolation - the circuit "ground" of the connected device is connected to the circuit "ground" of the computer. The data rate can reach up to 115200 bps.

The RS-232C standard describes unbalanced transmitters and receivers: the signal is transmitted relative to a common wire - the circuit "ground". The logical unit at the data input (signal RxD) corresponds to the voltage range from -12 to -3 V; logic zero - from +3 to +12 V. For control signal inputs, the ON state (on) corresponds to the range from +3 to +12 V, the OFF state (off) - from -12 to -3 V. The range is from -3 to + 3 V - dead zone, which causes the receiver hysteresis: the line state is considered changed only after crossing the threshold. The signal levels at the outputs of the transmitters must be in the ranges from -12 to -5 V and from +5 to +12 V.

The interface assumes the presence of a protective earth of the connected devices, if both of them are powered by the mains alternating current and have network filters.

At the physical level, the serial interface has various implementations that differ in the way electrical signals are transmitted. There are a number of international standards related to RS-232C. On fig. 25 shows the connection diagrams of their receivers and transmitters, and also shows the restrictions on the length of the line ( L) and the maximum data rate ( v). Unbalanced lines of RS-232C interfaces have the lowest immunity to common mode noise. Best Options have a point-to-point RS-422A interface and its trunk (bus) analog RS-485, operating on symmetrical communication lines. They use differential signals for each signal, with a separate (twisted) pair of wires for each signal circuit. Since these interfaces are logically related, it is permissible to use simple signal converters that provide a transition from one interface to another (Fig. 1).

RS-485 is used to exchange data between multiple devices one at a time. two-wire line communication (twisted pair) in half-duplex mode. Transmission is performed in only one direction at a time. Reception is not possible. To receive data, the transceiver must be switched to receive mode.
By electrical characteristics and principles of data transmission RS-422 is fully compatible with RS-485, but is duplex. In it, one twisted pair is constantly used for receiving, and the other for transmitting data.

Signal levels RS-485, RS-422
Data transmission takes place on two lines, A and B, which are twisted pair (two twisted wires). The principle of differential transmission of one signal is used. Wire A is the original signal, wire B is out of phase. When there is a logical 1 on one wire, a logical 0 on the other and vice versa. This achieves high immunity to common mode interference acting on both wires equally. electromagnetic interference, passing through the section of the communication line, induces the same potential in each wire, while the informative potential difference remains unchanged.
The transmitter must provide a signal level of 1.5 V at maximum load (32 standard inputs and 2 terminating resistors) and no more than 6 V without load. On the receiver side, the minimum received signal level must be at least 200 mV.

Hardware implementation
RS-422 is a full duplex interface. Reception and transmission go on two individual couples wires. Each pair of wires can have only one transmitter. Implemented in MAX488, MAX490 chips.
RS-485 - half duplex interface. Reception and transmission go on one pair of wires with time separation. There may be many transmitters on the network, as they can be disabled in receive mode. Implemented in ST485, MAX485 microcircuits.

Distance and data rate

SpeedDistance
62.5 kbps1200 m
375 kbps300 m
2.4 Mbps100 m
10 Mbps10 m
BORDER>

Number of connected devices in the RS-485 line
The number of devices connected to one interface line depends on the input impedance of the receivers. The input impedance of the receiver, according to the standard, must be greater than or equal to 12 kOhm. This resistance corresponds to a unit load (UL). One transmitter is designed to control 32 standard receivers. Receivers are available with 1/2 UL, 1/4 UL, 1/8 UL loading. When using such receivers, the total number of devices can be increased to 64, 128 or 256, respectively.

Coordination
The electrical signal is reflected from the open ends of the transmission line. If the distance is large enough, the edge of the signal, reflected at the end of the line and returned back, can distort the current or next signal. In such cases, you need to somehow suppress the reflection effect.
At the remote end of the line, between the conductors of the twisted pair, include a resistor with a rating equal to the characteristic impedance of the line. The electromagnetic wave reached the "dead end" is absorbed by the resistor. Hence its name - terminating resistor or "terminator". The nominal resistance of the terminating resistor corresponds to the characteristic impedance of the cable and is usually 120 ohms.

The resistor can be soldered onto the cable connector pins of the end devices. Sometimes resistors are mounted in the device itself and a jumper must be installed to connect the resistor (as in our products VTR-232/485, VTR-E/485, USB-485M).

Protective offset
When the receiver is disconnected from the line, or if there are no active transmitters in the line, the level of the electrical signal on wires A and B can be arbitrary. To avoid issuing erroneous signals to the UART receiver, it is necessary to set the pull-up of input A to power, and B to ground.

Our products (VTR-232/485, VTR-E/485, USB-485M...) have 680 ohm safety bias resistors.


When RS-485 is transmitting, the output of the RO receiver is switched to the third state and the RX leg of the controller (UART receiver) "hangs in the air". As a result, during transmission at the UART receiver, any interference will be taken as an input signal. To eliminate this situation, it is necessary to pull the output of the receiver RO to logic 1.

Our products (VTR-232/485, VTR-E/485, USB-485M ...) have a 10 kOhm receiver output pull-up resistor.


When the power is turned on or the equipment is rebooted by the "Reset" signal, the controller needs a few milliseconds to initialize. It turns out a situation in which power has already been supplied to the RS-485/422 transceiver chip, but the /RE and DE transmitter permission inputs are "hanging in the air". As a result, the transceiver can open for transmission due to interference and transmit garbage to the working line all the time while the microcontroller is initialized. To exclude this, it is necessary to pull the transmitter switch-on to the “ground” with a resistor. Thus, immediately when the power is turned on, the transmitter is turned on for reception and does not litter the line.

Our products (VTR-232/485, VTR-E/485, USB-485M ...) have a 10 kΩ transmitter pull-up resistor.


Devices are often long distance from each other, therefore, galvanic isolation is usually required, the functions of which are to break the common "earth" circuit, protect the entire system from high-voltage transients, reduce interference and signal distortion, and increase the degree of electrical safety.

Specifications RS-485 and RS-422 standards.

ParameterRS-422RS-485
Allowed number of Tx and Rx1 Tx, 10 Rx32 Tx, 32 Rx
Maximum cable length1200 m1200 m
Maximum data transfer rate10 Mbps10 Mbps
Transmitter "1" voltage range+2...+10 V+1.5...+6 V
Transmitter "0" voltage range-2...-10 V-1.5...-6 V
Transmitter maximum short circuit current150 mA250 mA
Permissible load impedance of the transmitter100 ohm54 ohm
Rx Input Sensitivity± 200 mV± 200 mV
Receiver input impedance4 kOhm12 kOhm
Rx input voltage range±7V -7...+12 V
Logic one level Rx> 200 mV> 200 mV
Logic zero level Rx
BORDER>

Naturally, this allows manufacturers to fence anyone into anything (for example, power supply via the 9th pin in RS-232 is not at all specified by the standard, but it is widely used) and this is called a standard. Further, all RS protocols can be roughly divided into half-duplex and full-duplex. True, such a division is not entirely accurate, because. the same RS-485 can be both half-duplex (two wires) and full-duplex (four wires), they are called 2-wire (2-wire) RS-485 and 4-wire (4-wire) RS-485. There is also such a type of protocol as simplex, but due to a number of reasons listed below, they are not used in computer technology. How do these types of protocols differ:

  • simplex protocols allow data to be transmitted only in one direction, i.e. only from the transmitter to the receiver, but not vice versa. Good example simplex protocol - FM radio or TV, unless you take into account the ability to call the radio station. It is used in cases where you just need to transfer information to any device without the need for confirmation and feedback.
  • half-duplex protocols remove the main limitation of simplex protocols - one-way communication. They allow two devices to exchange information, and both devices can be both receivers and transmitters, but not at the same time! Those. each device can either transmit or receive (by the way, the classic / recommended / RS-485 is half-duplex).
  • duplex protocols are the most advanced protocols. The use of a duplex protocol allows both the reception and transmission of information at the same time, i.e. both devices can be both a receiver and a transmitter at the same time. For example, RS-232 is a duplex protocol.

Specifically about different protocols

The most used in the computer industry are two protocols - RS-232 and RS-485 (well, RS-422, which is very similar to RS-485). An important difference: the RS-232 protocol uses an unbalanced signal, while the RS-422/RS-485 protocol uses a balanced signal.

An unbalanced signal is transmitted on an unbalanced line, which is a signal ground and a single signal wire, the voltage level on which is used to transmit or receive binary 1s or 0s. In contrast, a balanced signal is transmitted on a balanced line, which is represented by a signal ground and a pair of wires, the voltage difference between which is used to transmit/receive binary information (all together make up a shielded twisted pair).

Without going into details, we can say that a balanced signal is transmitted faster and farther than an unbalanced one. Here is a comparison table for the recommended protocols (it must be said that the current interpretations of the protocols, especially RS-232, are very far from the recommended ones):

RS-232 RS-422 RS-485
Connections single wire Single wire/multiple connections allowed Many connections are allowed
Number of devices 1 transmitter
1 receiver
5 transmitters
10 receivers per 1 transmitter
32 transmitters
32 receivers
Protocol type duplex duplex half duplex
Max. wire length ~15.25m at 19.2Kbps ~1220 m at 100Kbps ~1220 m at 100Kbps
Max. transmission speed 19.2Kbps for 15m. 10Mbps for 15m. 10Mbps for 15m.
Signal unbalanced balanced balanced
binary 1 -5V min.
-15V max.
2V min. (B>A)
6V max. (B>A)
1.5V min. (B>A)
5V max (B>A)
binary 0 5V min.
15V max.
2V min. (A>B)
6V max. (A>B)
1.5V min. (A>B)
5V max (A>B)
Min. input voltage +/- 3V 0.2V dif. 0.2V dif.
Output current 500mA 150mA 250mA

Let me note that the RS-232 controllers used in personal computers, have an output current of 10mA maximum.

More about RS-232

All equipment connected by RS-232 protocol is divided into DCE (Data Communication Equipment, Data Communication Equipment) and DTE (Data Terminal Equipment, Terminal Equipment), two DTEs or two DCEs cannot be connected. The difference lies in the connectors and connector pinouts: DCE devices have a DB25F (female) connector, while DTE devices have a DB25M (male) connector. Also on DTE devices (for example, on computers, computers are DTE devices) sometimes a stripped-down version of DB25M - DB9M is used. With the help of NULL-modem (Null-modem) you can turn DTE into DCE and vice versa. Visually see how DTE connectors differ from DCE:

DCE (DB25F) DTE (DB25M) DTE (DB9M)
pin 1 Protective earth Protective earth CD (Carrier Detect) input
pin 2 RD (Receive Data,
receiving data)
entrance
data) output
TD (Transmitted Data,
Data transfer)
exit
RD (Receive Data,
receiving data)
entrance
pin 3 TD (Transmitted Data,
Data transfer)
exit
RD (Receive Data,
receiving data) input
TD (Transmitted Data,
Data transfer)
exit
pin 4 CTS (Clear To Send,
Admission Request
data) input
RTS (Request To
Send, Request for
data transmission)
exit
DTR (Data
terminal ready,
DTE ready)
exit
pin 5 RTS (Request To Send,
Transfer request
data) output
CTS (Clear To Send,
Admission Request
data) input
signal earth
pin 6 DTR (Data Terminal)
Ready, DTE ready)
exit
DSR (Data Set Ready,
DCE ready) input
DSR (Data Set Ready,
DCE ready) input
pin 7 signal earth signal earth RTS (Request To Send,
Transfer request
data) output
pin 8 CD (Carrier Detect) output CD (Carrier Detect,
carrier) input
CTS (Clear To Send,
Admission Request
data) input
pin 9 N/A N/A RI (Ring Indicator,
call indicator)
entrance
pin 20 DSR (Data Set Ready,
DCE ready) input
DTR (Data Terminal)
Ready, DTE ready)
exit N/A
pin 22 RI (Ring Indicator,
call indicator)
exit
RI (Ring Indicator,
call indicator)
input N/A

More specifically about RS-485/RS-422

RS-485/RS-422 use shielded twisted pair, shield as signal ground. Although the signal ground is required, it is not used to determine the logical state of the line. A device driving a balanced line driver may (mandatory for RS-485, not for RS-422) also have an "Enable" input signal that is used to control the output terminals of the device. If the "Enable" signal is off, then the device is offline, and the device's disabled state is usually called "tristate" (i.e., the third state, in addition to binary 1s and 0s).

The RS-485 standard provides for only 32 transmitter/receiver pairs, but manufacturers have expanded the capabilities of the RS-485 protocol so that it now supports from 128 to 255 devices on one line, and using repeaters, you can extend RS-485/RS-422 to almost infinity. When using RS-485, it is possible, and in the case of a long wire and / or a large number of devices it is necessary, to use terminators, which, however, are usually built into devices with RS-485 protocol, although with a short wire, even communication degradation can be observed when using terminators. The RS-485 standard also provides for the use of a two-wire shielded twisted pair, the so-called 2-wire RS-485, but it is also possible to use a four-wire twisted pair (4-wire RS-485), then full duplex is obtained. In this case, it is necessary that one of the devices be configured as a master (Master), and the rest as slaves (Slave). Then all the slaves only talk to the master and never send anything directly to each other. In such cases, the RS-422 driver is usually used as the master, as RS-422 allows connections only as master / slave, and RS-485 devices as slaves, for the overall reduction in the cost of the system. The standard on RS-422 initially provides for the use of a four-wire shielded twisted pair, but only allows connections from one device to another (up to five drivers and up to ten receivers per driver). In principle, RS-422 was invented to replace RS-232 in cases where RS-232 does not satisfy the transmission speed and range.

RS-422 uses strictly separated two (or more) pairs of wires: one for receive, one for transmit (and one for each control/handshake signal). RS-485, due to the presence of the third state ("tristate"), allows you to get by with one pair of wires, which reduces the overall cost of the system when communicating over long distances. It must be said that a large number of various devices are now available for interfacing RS-422/RS-485 with RS-232, and RS-232 is often used to connect to a computer (however, there are also RS-422/RS-485 interface cards to a computer ), which is used to control the system. A variety of devices (hubs, repeaters, switches, etc.) are also available to create complex configurations of RS-422/RS-485 networks, so RS-422/RS-485 is fraught with very great possibilities.

The RS-422 and RS-485 interfaces eliminated the shortcomings of the RS-232 interface, which is widely used in personal computers. The construction of RS-422/RS-485 interfaces is based on the principle of differential data transmission. Its essence lies in the transmission of one signal over two wires twisted together and forming a twisted pair. Usually one wire is conventionally referred to as 'A', and the other as 'B'. The useful signal is the potential difference between wires A and B: U A - U B = U AB. Interfaces require line transmitters with differential outputs and line receivers with differential inputs.

On fig. Figure 1 shows a conventional image of a linear transmitter of RS-422/RS-485 interfaces and a timing diagram of its output signal. The transmitter provides a voltage of 2 to 6 V between pins A and B. The transmitter also has a common point (wire) pin of the circuit. Unlike the RS-232C interface, the common wire here is not used to determine the status of the data line, but is used only to connect the signal ground. If at the transmitter output 2< U AB < 6 В, то это соответствует логическому 0, а диапазон -6 < U AB < -2 В соответствует логической 1.

Rice. 1. RS-422/RS-485 interface transmitter:

a) - symbol; b) - timing diagram of the output signal U AB

The linear transmitter of the RS-485 interface must necessarily have the "Enable" control signal input. The purpose of this signal is to connect the outputs of the transmitter to line pins A and B. If the Enable signal is in the off state (usually logic 0), then the transmitter will be disconnected from the line. The off state of a line transmitter is commonly referred to as its third or Z-state.

The differential receiver analyzes the signals from the communication line arriving at its inputs A and B. If at the receiver input U A - U B \u003d U AB > 0.2 V, then this corresponds to logical 0, if U A - U B< -0,2 В, то это логическая 1. Диапазон | U A – U B | < 0,2 В является зоной нечувствительности (гистерезисом), защищающей от воздействия помех. Линейный приемник также должен иметь вывод C общего провода схемы, чтобы выполнить сигнальное заземление.



The use of the differential method of signal transmission provides good noise immunity of the interfaces. For the hardware implementation of the interface, transceiver chips (transceivers) with differential inputs/outputs connected to the line and digital inputs/outputs connected to the UART module of the microcontroller are used.

Comparison of RS-422 and RS-485 interfaces. The standard defines RS-422 as a point-to-point interface with one transmitter and up to ten receivers. On fig. 2 shows a diagram of connecting devices to interface lines for simplex (one-way) exchange. Duplex communication requires a second pair of wires with the same device connection.

Rice. 2. Connecting devices to the communication line of the RS-422 interface

The standard defines RS-485 as a multipoint interface that allows up to 32 transmitters, receivers, or combinations of them to be connected on a single line. On fig. 3 shows a diagram of connecting devices to interface lines for half-duplex exchange. Differential inputs of receivers of RS-422/485 interfaces protect against interference, but at the same time, the common points C of the devices must be connected to each other and to the ground bus. With a long communication line, an additional third interface wire is used to connect the common points. If a shielded twisted pair is used, then the shield can be used as the third wire.

Rice. 3. Connecting devices to the communication line of the RS-485 interface

Resistance matching in the communication line. For long distances between devices connected via twisted pair, and high speeds transmission, the so-called long line effects begin to appear. In this case, the transmitted signals are distorted due to the reflection of signals at the ends of the communication line.

It is known that any electrical communication line is characterized by wave resistance, which is determined only by its parameters: the area and cross-sectional shape of the wires, their relative position, thickness and type of dielectric between them. If you connect a resistor with a resistance equal to the wave resistance to the end of the line, the signal will not be reflected from it. Such a line is called a matched line. It has minimal distortion. The terminating resistor RC is installed at the end of the line towards which the signal is transmitted. In the RS-422 interface, it is located at the opposite end of the line from the transmitter (see Fig. 2). In the RS-485 interface, if the transmission is in two directions, terminating resistors RC are installed at both ends of the communication line (see Fig. 3). Currently applied twisted pairs have a wave impedance of the order of 120 ohms, so the resistance of the terminating resistors is also taken as 120 ohms. The term "terminating" resistor is not generally accepted. Often the terms are used instead: terminating or terminating resistor.

The maximum data transfer rate via RS-422/RS-485 interfaces is determined by many factors: the length and parameters of the communication line, parameters of receivers and transmitters. The maximum transmission rate over short distances (up to 12 m) is limited by the speed of the transmitters and is equal to 10 Mbps according to the standard. At medium distances (tens and hundreds of meters), the transmission rate decreases due to an increase in losses in the capacitances of the cable insulation and active resistances of the wires. So, for example, with a line length of 120 m, the maximum transmission rate does not exceed 1 Mbps. The maximum length of the communication cable according to the standard is limited to 1200 m, while the transmission rate does not exceed 100 Kbps.

The advantages of RS-422 and RS-485 interfaces are: low cost of connecting cables; cheap implementation of transceivers; a large fleet of operating equipment that implements these standards; the possibility of organizing galvanic isolation.

The disadvantage of interfaces is that they are not standard on computers and microcontrollers. The interfaces have a rather significant power consumption and a relatively low data transfer rate.


2022
maccase.ru - Android. Brands. Iron. news