Data transfer protocol via RS 485. Physical interfaces RS485 and RS422


The RS-485 standard was first adopted by the Electronics Industry Association. Today he examines the electrical characteristics of various receivers and transmitters that are used in balanced digital systems.


What is this standard?

RS-485 is the name of a well-known interface that is actively used in all kinds of industrial control systems for the purpose of connecting certain controllers and many other devices to each other. The main difference between this interface and RS-232 is that it involves combining several types of equipment simultaneously. When using RS-485, high-speed data exchange between several devices is guaranteed by using a single two-wire communication line in half-duplex mode. It is involved in modern industry in the creation of process control systems.

Range and speed

Using the presented standard, it is possible to achieve broadcasting of information at speeds of up to 10 Mbit/s. It is worth noting that the maximum possible range directly depends on the data transmission speed. It is worth noting that to ensure maximum speed, information can be transmitted no further than 120 meters. At the same time, at a speed of 100 kbit/s, data is transmitted over more than 1200 meters.

Number of connected devices

The number of devices that the RS-485 interface can integrate directly depends on what transceivers are involved in them. Each transmitter provides specific control over 32 standard receivers. However, you should be aware that there are receivers with input impedance that differ by 50%, 25% or less from the standard. If you use this equipment, the total number of devices increases accordingly.

Connectors and protocols

The RS-485 cable is not capable of normalizing any specific information frame format or exchange protocol. As a rule, similar frames used by RS-232 are used for broadcasting. In other words, data bits, stop and start bits, and a parity bit if necessary. As for the operation of communication protocols, in most modern systems it is carried out according to the “master-slave” principle. This means that a certain device on the network acts as a leader and initiates the exchange of sending requests between slave devices that differ in logical addresses. The most famous protocol currently is Modbus RTU. It should be noted that the RS-485 cable does not have a specific type of connectors or wiring. In other words, there are terminal connectors, DB9 and others.

Connection

Often, using the presented interface, a local network is found that simultaneously combines several types of transceivers. When connecting RS-485, it is necessary to correctly connect the signal circuits together. As a rule, they are called A and B. Thus, polarity reversal is not a big deal, it just causes the connected devices to stop working.

When using the RS-485 interface, it is necessary to take into account certain features of its operation. Thus, the recommendations are as follows:

1. The optimal medium for signal transmission is a twisted pair cable.
2. The ends of the cord must be plugged using specialized terminal resistors.
3. A network using standard or USB RS-485 must be laid without branches according to the bus topology.
4. Devices must be connected to the cable using cables of the shortest possible length.

Coordination

By using terminal resistors, standard or USB RS-485 ensures that the open end of the cord is fully matched to the downstream line. In this case, the possibility of signal reflection is completely excluded. The nominal resistance of resistors associated with the characteristic impedance of cables and wires based on twisted pairs is usually about 100-120 ohms. For example, the currently known UTP-5 cable, which is often used in the process of laying Ethernet, has a characteristic impedance of 100 Ohms.

As for other cable options, a different rating may be used. Resistors can be soldered to the contacts of cable connectors in end devices, if necessary. Infrequently, resistors are mounted in the equipment itself, resulting in the need to install jumpers to connect the resistor. In this case, when the device is connected, the line is mismatched. To ensure the normal functioning of the rest of the system, you will need to connect a matching plug.

Signal levels

The RS-485 port uses a balanced data transmission scheme. In other words, the voltage levels on signal circuits A and B change out of phase. The sensor provides a signal level of 1.5 V, taking into account the maximum load. In addition, no more than 6 V is provided when the device is idling. The voltage level is measured differentially. At the location of the receiver, the minimum level of the received signal must be at least 200 mV.

Bias

When no signal is observed on the signal circuits, a small bias is applied. It protects the receiver in case of a false alarm. Experts advise performing an offset slightly larger than 200 mV, because this value is considered to correspond to the input signal unreliability zone according to the standard. In such a situation, circuit A approaches the positive pole of the source, and circuit B is pulled toward the common.

Example

Based on the required bias and voltage of the power supply, the resistor values ​​are calculated. For example, if you want to get an offset of 250 mV using terminal resistors, RT = 120 ohms. It is worth noting that the source has a voltage of 12 V. Taking into account the fact that in this case two resistors are connected in parallel to each other and do not take into account the load on the receiver side, the bias current reaches 0.0042. At the same time, the total resistance of the bias circuit is 2857 Ohms. Rcm will be about 1400 Ohms. Thus, you will need to select the nearest denomination. An example will be a 1.5 kOhm resistor. It is necessary for displacement. In addition, an external 12 volt resistor is used.

It is also necessary to note that in the system there is an isolated output of the controller power supply, which represents the main link in its own circuit segment. True, there are other options for performing bias, where an RS-485 converter and other elements are involved, but it should still be taken into account that the node providing the bias will sometimes turn off or eventually be completely removed from the network. When offset exists, the full open circuit potential of circuit A is considered positive with respect to circuit B. This acts as a guide when connecting new equipment to the cable without using wire markings.

Incorrect wiring and distortion

Implementation of the recommendations indicated above makes it possible to achieve correct transmission of electrical signals to different points of the network when the RS-485 protocol is used as a basis. If at least one of the requirements is not met, signal distortion occurs. The most noticeable distortions appear when the information exchange rate is above 1 Mbit/s. True, even at lower speeds it is not recommended to neglect these tips. This rule also applies during normal network operation.

How to program?

When programming various applications that work with devices used by the RS-485 splitter and other devices with the presented interface, several important points should be taken into account.

Before the delivery of the package begins, it is necessary to activate the transmitter. It is worth noting that, according to some sources, delivery can be carried out immediately after activation. Despite this, some experts advise first to pause for a time equal to the broadcast speed of one frame. In this case, a correct receiving program can have time to fully identify errors in the transient process, which is able to carry out the normalization procedure and prepare for the next data reception.

When the last byte of data has been issued, you must also pause before disconnecting the RS-485 device. This is in some sense due to the fact that the serial port controller often contains two registers at the same time. The first is a parallel input, it is designed to receive information. The second is considered a shift output, it is used for the purpose of sequential output.

When the controller transmits data, any interrupts are generated when the input register is empty. This occurs when information has already been provided to the shift register, but has not yet been issued. This is also the reason why, after stopping the broadcast, it is necessary to take a certain pause before turning off the transmitter. It should be approximately 0.5 bits longer than the frame. When performing more accurate calculations, it is recommended to study in more detail the technical documentation of the serial port controller that is used.

It is possible that the transmitter, receiver and RS-485 converter are connected to a common line. In this way, the own receiver will also begin to perceive the transmission carried out by the own transmitter. It is often the case that in systems that are characterized by random line access, this feature is used to check that there is no collision between two transmitters.

Bus format configuration

The presented interface has the ability to combine devices using the “bus” format, when all equipment is connected using one pair of wires. This means that the communication line must be matched by end-of-line resistors at both ends. To ensure this, it is necessary to install resistors with a resistance of 620 Ohms. They are always mounted on the first and last device connected to the line.

As a rule, modern devices have a built-in matching resistance. If the need arises, it can be connected to the line by installing a special jumper on the device board. It is worth noting that the shipping state of the jumpers is first installed, so you need to remove them from all devices except the first and last. It should also be noted that in converter-repeaters of the S2000-PI model, for a separate output, the matching resistance is activated using a switch. As for the S2000-KS and S2000-K devices, which are characterized by a built-in matching resistor, there is no jumper required to connect it. To ensure a long communication line, it is advisable to use specialized repeaters-relays, which are pre-equipped with fully automatic switching of the transmission direction.

Star configuration

All branches in the RS-485 line are considered undesirable, as they cause excessive signal distortion. Although, from a practical point of view, it is possible to allow this when there is a short branch length. In this case, there is no need to install matching resistors on individual branches.

In an RS-485 system where control is provided using a remote control, when resistors and devices are connected to the same line, but are powered by different sources, it is necessary to combine the 0 V circuits of all devices and the remote control in order to achieve equalization of their potentials. When this requirement is not met, the remote control may have unstable communication with devices. When using a wire with several twisted pairs, a completely free pair can be used for the potential equalization circuit, if necessary. In addition, it is possible to use shielded twisted pair if there is no screen grounding.

What should you consider?

In most cases, the current passing through the potential equalization wire is considered to be quite small. If the 0 V of devices or the power supplies themselves are connected to several local ground buses, then the potential difference between different 0 V circuits can reach several units. Sometimes this value is around tens of volts, and the current that flows through the potential equalization circuit is quite significant. Often this is the reason why there is an unstable connection between the remote control and devices. As a result, they can even fail.

Thus, it is necessary to exclude the possibility of grounding the 0 V circuit or to ground this circuit at a certain point. In addition, the possibility of interconnection between 0 V and the protective ground circuit, which is present in the equipment used in the alarm system, should be taken into account. It is worth noting that in facilities where the electromagnetic environment is relatively harsh, it is possible to connect to this network by using a shielded twisted pair cable. It remains to be emphasized that in this situation there may be a shorter maximum range because the wire capacitance is considered higher.

In modern technology, the exchange of information between various devices is becoming increasingly important. And this requires transmitting data both over short distances and over long distances, on the order of kilometers. One of these types of data transfer is communication between devices via the RS-485 interface.

Where it is necessary to transmit data via RS 485.

One of the most common examples of using devices for data exchange is. Electricity meters, united into a single network, are dispersed in cabinets, switchgear cells and even substations located at a considerable distance from each other. In this case, the interface is used to send data from one or more metering devices.

The “one meter – one modem” system is being actively implemented to transfer data to the services of energy supply companies from metering centers of private houses and small enterprises.

Another example: receiving data from microprocessor relay protection terminals in real time, as well as centralized access to them for the purpose of making changes. For this purpose, the terminals are connected via a communication interface in a similar way, and the data from it goes to the computer installed at the dispatcher. If the protection is triggered, operating personnel have the opportunity to immediately obtain information about the location and nature of the damage to the power circuits.

But the most difficult problem solved by communication interfaces are centralized control systems for complex production processes - automated process control systems. The operator of an industrial installation has a computer on his desk, on the display of which he sees the current state of the process: temperatures, productivity, units turned on and off, their operating mode. And has the ability to control all this with a light click of the mouse.

The computer exchanges data with controllers - devices that convert commands from sensors into a language understandable by the machine, and the reverse conversion: from the language of the machine into control commands. Communication with the controller, as well as between different controllers, is carried out through communication interfaces.


The RS-232 interface is the younger brother of RS 485.

It is impossible not to at least briefly mention the RS-232 interface, which is also called serial. Some laptops have a connector for the corresponding port, and some digital devices (the same relay protection terminals) are equipped with outputs for communication using RS-232.

In order to exchange information, you need to be able to transmit and receive it. For this purpose there is a signal transmitter and receiver. They are available in every device. Moreover, the transmitter output of one device (TX) is connected to the receiver input of another device (RX). And, accordingly, along the other conductor in a similar way the signal moves in the opposite direction.

This provides a half-duplex communication mode, that is, the receiver and transmitter can operate simultaneously. Data over an RS-232 cable can move in one direction and the other at the same time.

The disadvantage of this interface is low noise immunity. This occurs due to the fact that the signal in the connecting cable for both reception and transmission is formed relative to a common wire - the ground. Any interference that exists even in a shielded cable can lead to communication failure and loss of individual bits of information. And this is unacceptable when managing complex and expensive mechanisms, where any mistake is an accident, and loss of communication means a long downtime.

Therefore, it is mainly used for small temporary connections between a laptop and a digital device, for example, to install the initial configuration or correct errors.


Organization of the RS-485 interface.

The main difference between RS-458 and RS-232 is that all receivers and transmitters operate on one pair of wires, which is the communication line. The ground wire is not used in this case, and the signal in the line is generated by the differential method. It is transmitted simultaneously over two wires (“A” and “B”) in inverse form.

If the output of the transmitter is logical “0”, then a zero potential is applied to conductor “A”. On conductor “B” a signal “not 0” is generated, that is, “1”. If the transmitter broadcasts “1”, the opposite happens.

As a result, we get a change in the signal voltage between two wires, which are a twisted pair. Any interference entering the cable changes the voltage relative to ground equally on both wires of the pair. But the voltage of the useful signal is formed between the wires, and therefore does not suffer at all from the potentials on them.

The procedure for exchanging data between devices via RS-485.

All devices connected by the RS-485 interface have only two terminals: “A” and “B”. To connect to the general network, these terminals are connected in a parallel circuit. To do this, a chain of cables is laid from one device to another.

In this case, there is a need to streamline the exchange of data between devices, establishing the order of transmission and reception, as well as the format of the transmitted data. For this purpose, a special instruction is used, called a protocol.

There are many data exchange protocols via the RS-485 interface, the most commonly used is Modbas. Let's briefly look at how the simplest protocol works and what other problems have to be solved with its help.

As an example, let's look at a network in which one device collects data from several data sources. This could be a modem and a group of electricity meters. In order to know which meter the data will come from, each transceiver is assigned a number that is unique for a given network. The number is also assigned to the modem transceiver.

When it's time to collect data on energy consumption, the modem generates a request. First, a start pulse is transmitted, by which all devices understand that a code word is about to arrive - a message consisting of a sequence of zeros and ones. In it, the first bits will correspond to the subscriber number on the network, the rest will be data, for example, a command to transmit the required information.

All devices receive the message and compare the number of the called subscriber with their own. If they match, the command sent as part of the request is executed. If not, the device ignores its text and does nothing.

At the same time, in many protocols, confirmation is sent back that the command has been accepted for execution or executed. If there is no response, the sending device can repeat the request a certain number of times. If there is still no response, error information is generated related to the failure of the communication channel with the silent subscriber.

There may be no answer not only in the event of a breakdown. If there is strong interference in the communication channel, which nevertheless penetrates there, commands may not reach their destination. They are also subject to distortion and are not recognized correctly.

Incorrect execution of the command cannot be allowed, therefore, obviously redundant information is entered into the data parcels - a checksum. It is calculated according to a certain law, prescribed in the protocol, on the transmitting side. At the reception, the checksum is calculated according to the same principle and compared with the transmitted one. If they match, the reception is considered successful and the command is executed. If not, the device sends an error message to the sending side.

Requirements for cable connections.

To connect devices with the RS-485 interface, twisted pair cables are used. Although one pair of wires is enough to transmit data, cables with at least two are usually used so that a reserve is provided.

For better protection against interference, the cables are shielded, and the shields along the entire line are connected to each other. For this purpose, in addition to the “A” and “B” terminals, the devices being connected have a “COM” terminal. The line is grounded at only one point, usually at the location of the controller, modem or computer. It is prohibited to do this at two points in order to avoid interference that will inevitably flow across the screen due to the potential difference at the grounding points.

The cables are connected only in series with each other; branches cannot be made. To match the line, a resistor with a resistance of 120 Ohms is connected at its end (this is the characteristic impedance of the cable).

In general, installing interface cable lines is a simple task. It will be much more difficult to configure the equipment, which will require people with special knowledge.

To better understand the operation of the RS-485 interface, we suggest you watch the following video:

The purpose of this article is to provide basic guidelines for selecting wiring diagrams for RS-485 based networks. The RS-485 specification (officially known as TIA/EIA-485-A) does not specifically explain how RS-485 networks should be wired. However, it does provide some guidance. These recommendations and engineering practices in audio processing form the basis of this article. However, the advice presented here by no means covers the variety of possible networking options.

RS-485 transmits digital information between many objects. Data transfer speeds can reach 10 Mbit/s, and sometimes exceed this value. RS-485 is designed to transmit this information over long distances, and 1000 meters is well within its capabilities. The distance and data rate at which RS-485 can be used successfully depends on many factors when designing the system's interconnection design.

Cable

RS-485 is designed as a balanced system. In simple terms, this means that, in addition to ground, there are two wires that are used to transmit the signal.

Rice. 1. The balanced system uses, in addition to the ground wire, two wires for data transmission.

The system is called balanced because the signal on one wire is the perfect opposite of the signal on the second wire. In other words, if one wire is transmitting a high level, the other wire will transmit a low level, and vice versa. See Fig. 2.

Rice. 2. The signals on the two wires of the balanced system are perfectly opposite.

Although RS-485 can successfully transmit using various types of transmission media, it must be used with wiring commonly called "twisted pair".

What is twisted pair and why is it used?

As its name suggests, twisted pair is simply a pair of wires that are of equal length and twisted together. Using an RS-485-compliant transmitter over twisted-pair cabling reduces two major sources of problems for high-speed WAN designers: radiated EMI and induced EMI (coupling).

Radiated electromagnetic interference

As shown in Figure 3, whenever pulses with steep edges are used to transmit information, high-frequency components are present in the signal. These steep edges are needed at higher speeds than RS-485 can provide.

Rice. 3. Waveform of a 125 kHz square wave train and its FFT

The resulting high-frequency components of these steep edges, together with long wires, can result in electromagnetic interference (EMI) emissions. A balanced system using twisted pair links reduces this effect, making the system an inefficient radiator. It works on a very simple principle. Since the signals on the lines are equal but inverse, the signals emitted from each wire will also tend to be equal but inverted. This creates the effect of suppressing one signal by another, which, in turn, means the absence of electromagnetic radiation. However, this is based on the assumption that the wires are exactly the same length and exactly the same arrangement. Since it is impossible to have two wires exactly the same at the same time, the wires should be as close to each other as possible. Twisting the wires helps neutralize any residual electromagnetic radiation due to the finite distance between the two wires.

Induced electromagnetic interference

Induced EMI is basically the same problem as radiated EMI, but in reverse. The interconnects used in an RS-485 based system also act as an antenna that receives unwanted signals. These unwanted signals can distort useful signals, which in turn can lead to data errors. For the same reason that twisted pair wire helps prevent radiated EMI, it will also help reduce the effects of conducted EMI. Because the two wires are placed together and twisted, the noise induced on one wire will tend to be the same as that induced on the second wire. This type of noise is called "common mode noise". Since RS-485 receivers are designed to detect signals that are opposite of each other, they can easily suppress noise that is common to both wires.

Characteristic impedance of twisted pair

Depending on the cable geometry and the materials used in the insulation, the twisted pair will have a corresponding "characteristic impedance", which is usually determined by its manufacturer. The RS-485 specification recommends, but does not explicitly mandate, that this characteristic impedance be 120 ohms. The recommendation of this impedance is necessary to calculate the worst case load and common mode voltage ranges defined in the RS-485 specification. Apparently the specification does not dictate this impedance in the interest of flexibility. If for some reason 120 ohm cable cannot be used, it is recommended that the worst case load case (allowable number of transmitters and receivers) and worst case common mode voltage ranges be recalculated to ensure that the designed system will operate. Publication TSB89 contains a section specifically devoted to such calculations.

Number of twisted pairs per transmitter

Now that we understand what type of cable is needed, the question arises of how many twisted pairs the transmitter can handle. The short answer is exactly one. Although a transmitter may be able to drive more than one twisted pair cable under some circumstances, this is not part of the specification.

Termination resistors

Since high frequencies and long distances are involved, due attention must be paid to the effects occurring in the communication lines. However, a detailed discussion of these effects and correct matching methods is far beyond the scope of this article. With this in mind, the conditioning technique will be briefly discussed in its simplest form as it relates to RS-485.

A terminating resistor is simply a resistor that is installed at the extreme end or ends of the cable (Figure 4). Ideally, the resistance of the matching resistor is equal to the characteristic impedance of the cable.

Figure 4. The matching resistors must have a resistance equal to the characteristic impedance of the twisted pair and must be placed at the far ends of the cable.

If the resistance of the matching resistors is not equal to the characteristic impedance of the cable, reflection will occur, i.e. the signal will return back through the cable. This is described by the equation (Rt-Zo)/(Zo+Rt), where Zo is the cable resistance and Rt is the value of the matching resistor. Although some reflection is inevitable due to cable and resistor tolerances, large variations can cause reflections large enough to cause data errors. See Figure 5.

Rice. 5. Using the circuit shown in the top figure, the signal on the left was obtained with the MAX3485 terminated on a 120-ohm twisted pair cable and a 54-ohm termination resistor. The signal on the right was obtained when correctly matched using a 120 ohm resistor.

With this in mind, it is important to ensure that the resistance values ​​of the matching resistor and the characteristic impedance are as close as possible. The location of the matching resistor is also very important. Termination resistors should always be placed at the far ends of the cable.

As a general rule, termination resistors should be placed at both far ends of the cable. Although proper termination of both ends is absolutely critical for most system designs, it can be argued that in one special case only one termination resistor is needed. This case occurs in a system in which there is a single transmitter, and that single transmitter is located at the far end of the cable. In this case, there is no need to place a terminating resistor at the transmitter end of the cable, since the signal always propagates from that transmitter.

Maximum number of transmitters and receivers in the network

The simplest RS-485-based network consists of one transmitter and one receiver. Although useful in a number of applications, RS-485 introduces greater flexibility by allowing more than one receiver and transmitter on a single twisted pair cable. The allowed maximum depends on how much each device loads the system.

In an ideal world, all receivers and inactive transmitters would have infinite impedance and would never load the system. In the real world, however, this does not happen. Each receiver connected to the network and all inactive transmitters increase the load. To help the RS-485 network designer figure out how many devices can be added to the network, a hypothetical unit called a "unit load" was created. All devices that connect to the RS-485 network must be characterized by their multiplier ratio or unit load fraction. Two examples are the MAX3485, which is specified as 1 unit load, and the MAX487, which is specified as 1/4 unit load. The maximum number of unit loads on a twisted pair cable (assuming we are dealing with a properly terminated cable having a characteristic impedance of 120 ohms or greater) is 32. For the examples above, this means that up to 32 MAX3485 or up to 128 MAX487.

Examples of correct networks

Armed with the above information, we are ready to design some RS-485 based networks. Here are some simple examples.

One transmitter, one receiver

The simplest network is one transmitter and one receiver (Figure 6). In this example, a termination resistor is shown on the cable on the transmitter side. Although not necessary here, it is probably a good practice to design networks with both termination resistors. This allows the transmitter to be moved to locations other than the far end of the cable, and also allows additional transmitters to be added to the network if the need arises.

Rice. 6. RS-485 network with one transmitter and one receiver

One transmitter, multiple receivers

Figure 7 shows a network with one transmitter and multiple receivers. It is important here that the distances from the twisted pair to the receivers are as short as possible.

Rice. 7. RS-485 network with one transmitter and multiple receivers

Two transceivers

Figure 8 shows a network with two transceivers.

Rice. 8. RS-485 network with two transceivers

Multiple transceivers

Figure 8 shows a network with multiple transceivers. As with the single transmitter and multiple receivers example, it is important to keep the distances from the twisted pair cable to the receivers as short as possible.

Rice. 9. RS-485 network with multiple transceivers

Examples of incorrect networks

Below are examples of misconfigured systems. Each example compares the waveform received from an incorrectly designed network with the waveform received from a properly designed system. The waveform was measured differentially at points A and B (A-B).

Inconsistent network

In this example, there are no terminating resistors at the ends of the twisted pair. As the signal travels from the source, it encounters an open circuit at the end of the cable. This results in impedance mismatch, causing reflection. In the case of an open circuit (as shown below), all the energy is reflected back to the source, causing a highly distorted waveform.

Rice. 10. An uncoordinated RS-485 network (top) and its resulting waveform (left) compared to the signal received on a properly negotiated network (right)

Incorrect terminator placement

In Figure 11, a terminating resistor is present, but its placement is different from the far end of the cable. As the signal propagates from the source, it encounters two impedance mismatches. The first is found on the matching resistor. Even though the resistor is matched to the characteristic impedance of the cable, there is still a cable behind the resistor. This additional cable causes mismatch and therefore signal reflection. The second mismatch, the end of the unmatched cable, leads to additional reflections.

Rice. 11. RS-485 network with an incorrectly placed termination resistor (top) and its resulting waveform (left) compared to the signal received on a correctly terminated network (right)

Composite cables

There are a number of interconnection issues in Figure 12. The first problem is that RS-485 drivers are designed to drive only one properly terminated twisted pair cable. Here, each transmitter controls four parallel twisted pairs. This means that the required minimum logic levels cannot be guaranteed. In addition to the heavy load, there is an impedance mismatch at the point where multiple cables are connected. Impedance mismatch once again means reflections and, as a result, signal distortion.

Rice. 12. RS-485 network incorrectly using multiple twisted pairs

Long taps

In Figure 13, the cable is correctly matched and the transmitter is loaded on only one twisted pair; however, the wire segment at the connection point (stub) of the receiver is excessively long. Long taps cause significant impedance mismatch and thus signal reflection. All taps should be as short as possible.


Rice. 13. RS-485 network using a 3-meter tap (top) and its resulting signal (left) compared to the signal received with a short tap

In industrial applications, wireless data lines will never be able to completely replace wired. Among the latter, the most common and reliable is still serial interface R.S. -485 . And the company, in turn, remains the manufacturer of the most protected from external influences and various in configuration and degree of integration of transceivers for itMaxim Integrated .

Despite the growing popularity of wireless networks, wired networks provide the most reliable and stable communications, especially in harsh operating conditions. Properly designed wired networks enable efficient communications in industrial and process control applications while providing immunity to interference, ESD, and surge voltages. The distinctive features of the RS-485 interface have led to its widespread use in industry.

Comparison of RS-485 and RS-422 interfaces

The RS-485 transceiver is the most common physical layer interface for implementing serial networks designed for harsh environments in industrial applications and building automation systems. This serial interface standard provides high-speed data exchange over a relatively long distance over a single differential line (twisted pair). The main problem with the use of RS-485 in industry and in automated building control systems is that electrical transients that occur during rapid switching of inductive loads, electrostatic discharges, as well as pulse overvoltages, affecting networks of automated control systems, can distort the transmitted data or lead to their failure.

Currently, there are several types of data transfer interfaces, each of which is designed for specific applications, taking into account the required set of parameters and protocol structure. Serial communication interfaces include CAN, RS-232, RS-485/RS-422, I 2 C, I 2 S, LIN, SPI and SMBus, but RS-485 and RS-422 are still the most reliable especially under harsh operating conditions.

The RS-485 and RS-422 interfaces are similar in many ways, but they have some significant differences that must be taken into account when designing data transmission systems. According to the TIA/EIA-422 standard, the RS-422 interface is specified for industrial applications with one data bus master device to which up to 10 slave devices can be connected (Figure 1). It provides transmission speeds of up to 10 Mbps using twisted pair cable, which improves noise immunity and achieves the highest possible range and data transfer speed. Typical applications for RS-422 include process automation (chemical manufacturing, food processing, paper mills), complex manufacturing automation (automotive and metalworking industries), ventilation and air conditioning systems, security systems, motor control and object movement control.

RS-485 provides greater flexibility due to the ability to use multiple master devices on a common bus, as well as increasing the maximum number of devices on the bus from 10 to 32. According to the TIA/EIA-485 standard, the RS-485 interface has more a wide range of common-mode voltage (-7...12 V instead of ±7V) and a slightly smaller range of differential voltage (±1.5 V instead of ±2 V), which ensures a sufficient level of the receiver signal at maximum line load. Using the advanced capabilities of the multidrop data bus, you can create networks of devices connected to a single RS-485 serial port. Due to its high noise immunity and multi-drop connectivity, RS-485 is the best serial interface for use in industrial distributed systems connecting to a programmable logic controller (PLC), graphics controller (HMI), or other data acquisition controllers. Since RS-485 is an extension of RS-422, all RS-422 devices can be connected to a bus controlled by an RS-485 master. Typical applications for RS-485 are similar to those listed above for RS-422, with more frequent use of RS-485 due to its advanced capabilities.

RS-485 is the most popular industrial interface

The TIA/EIA-485 standard allows the use of RS-485 at a distance of up to 1200 m. At shorter distances, data transfer rates are more than 40 Mbit/s. Using a differential signal gives the RS-485 interface longer range, but the data transfer rate decreases as the line length increases. The data transfer speed is also affected by the cross-sectional area of ​​the line wires and the number of devices connected to it. When it is necessary to obtain both long range and high data transfer rates, it is recommended to use RS-485 transceivers with built-in high-frequency equalization, for example, MAX3291. The RS-485 interface can be used in half-duplex mode using one twisted pair of wires, or in full-duplex mode with simultaneous transmission and reception of data, which is ensured by using two twisted pairs (four wires). In a multidrop configuration in half-duplex mode, RS-485 is capable of supporting up to 32 transmitters and up to 32 receivers. However, newer generation transceiver ICs have higher input impedance, which allows the receiver line load to be reduced by 1/4 to 1/8 of the standard value. For example, using the MAX13448E transceiver, the number of receivers connected to the RS-485 bus can be increased to 256. With the Enhanced Multidrop RS-485 interface, you can network multiple devices connected to a single serial port, as shown in Figure 2.

Receiver sensitivity is ±200 mV. Therefore, to recognize one bit of data, the signal levels at the receiver connection point must be greater than +200 mV for zero and less than -200 mV for one (Figure 3). In this case, the receiver will suppress interference, the level of which is in the range of ±200 mV. The differential line also provides effective common mode rejection. The minimum input impedance of the receiver is 12 kOhm, the output voltage of the transmitter is in the range of ± 1.5…± 5 V.

Issues associated with using a serial interface in an industrial environment

Developers of industrial systems face the challenge of ensuring reliable operation in electromagnetic environments that can damage equipment or disrupt digital communications systems. One example of such systems is the automatic control of technological equipment at an automated industrial enterprise. The controller that controls the process measures its parameters, as well as environmental parameters, and transmits commands to actuators or generates alarms. Industrial controllers are, as a rule, microprocessor devices whose architecture is optimized to solve the problems of a given industrial enterprise. Point-to-point data lines in such systems are subject to strong electromagnetic interference from the environment.

DC-DC converters used in industrial manufacturing operate with high input voltages and provide input-isolated voltages to power the load. To power distributed system devices that do not have their own network power source, 24 or 48 V DC voltages are used. The terminal load is powered by a voltage of 12 or 5 V, obtained by converting the input voltage. Systems that communicate with remote sensors or actuators require protection from transients, electromagnetic interference, and ground potential differences.

Many companies, such as Maxim Integrated, work hard to ensure that integrated circuits for industrial applications are highly reliable and resistant to harsh electromagnetic environments. Maxim's RS-485 transceivers have built-in high-voltage ESD and surge protection circuits and are hot-swappable without losing data on the line.

Protection of data transmission systems from adverse external influences

Enhanced ESD protection

Electrostatic discharge (ESD) occurs when two oppositely charged materials come into contact, resulting in the transfer of static charges and the formation of a spark discharge. ESD often occurs when people come into contact with surrounding objects. Spark discharges that occur when semiconductor devices are handled carelessly can significantly degrade their characteristics or lead to complete destruction of the semiconductor structure. ESD can occur, for example, when replacing a cable or simply touching an I/O port and lead to the port being disabled due to the failure of one or more interface chips (Figure 4).

Such accidents can lead to significant losses, as they increase the cost of warranty repairs and are perceived by consumers as a consequence of the low quality of the product. In industrial manufacturing, ESD is a serious problem that can cause billions of dollars in losses annually. Under real operating conditions, ESD can lead to failure of individual components and sometimes the failure of the system as a whole. External diodes can be used to protect data interfaces, but some interface ICs contain built-in ESD protection components and do not require additional external protection circuits. Figure 5 shows a simplified functional diagram of a typical integrated ESD protection circuit. Surge noise on the signal line is limited by the diode protection circuit at the VCC and ground voltage levels and thus protects the internal circuitry from damage. Currently manufactured interface ICs and analog switches with built-in ESD protection generally comply with the IEC 61000-4-2 standard.

Maxim Integrated has invested heavily in developing ICs with robust built-in ESD protection and is currently a leader in RS-232 to RS-485 transceivers. These devices are designed to withstand IEC 61000-4-2 and JEDEC JS-001 ESD test pulses applied directly to the I/O ports. Maxim's ESD solutions are reliable, affordable, require no additional external components, and are less expensive than most competitors. All interface chips produced by this company contain built-in elements that protect each pin from ESD arising during production and operation. The MAX3483AE /MAX3485AE family of transceivers protect transmitter outputs and receiver inputs from high-voltage pulses up to ±20 kV in amplitude. At the same time, the normal operation of the products is maintained; there is no need to turn off and turn on the power again. In addition, built-in ESD protection features provide low-power operation during power-on, power-off, and standby modes.

Surge protection

In industrial applications, the inputs and outputs of RS-485 drivers are susceptible to faults resulting from surge voltages. The parameters of surge overvoltages differ from ESD - while the duration of ESD is usually in the range of up to 100 ns, the duration of pulse overvoltages can be 200 μs or more. Causes of surge voltages include wiring errors, poor connections, damaged or faulty cables, and drops of solder that can form a conductive connection between power and signal lines on a printed circuit board or connector. Since industrial power systems use voltages greater than 24 V, exposing standard RS-485 transceivers that do not have surge protection to such voltages will cause them to fail within minutes or even seconds. To protect against surge voltages, conventional RS-485 interface microcircuits require expensive external devices made of discrete components. RS-485 transceivers with built-in surge protection can withstand common-mode noise on the data line up to ±40, ±60, and ±80 V. Maxim produces a line of RS-485/RS-422 transceivers, MAX13442E to MAX13444E, that are tolerant of DC input voltages and outputs up to ±80 V relative to ground. Security elements operate regardless of the current state of the chip - whether it is on, off or in standby mode - making these transceivers the most reliable in the industry, ideal for industrial applications. Maxim transceivers remain operational under voltage surges caused by shorted power and signal lines, wiring errors, incorrect connector connections, defective cables, and improper operation.

Receiver resistance to uncertain line conditions

An important characteristic of RS-485 interface microcircuits is the receivers’ immunity to undefined line conditions, which guarantees that a high logical level is set at the receiver output when the inputs are open or closed, as well as when all transmitters connected to the line go into inactive mode (high-impedance state of the outputs). The problem of the receiver correctly perceiving signals from a closed data line is solved by shifting the input signal thresholds to negative voltages of -50 and -200 mV. If the input differential voltage of the receiver V A - V B is greater than or equal to -50 mV, the output R 0 is set to a high level. If V A – V B is less than or equal to -200 mV, the output R 0 is set to a low level. When all transmitters go into an inactive state and there is a termination in the line, the differential input voltage of the receiver is close to zero, as a result of which the receiver output is set to a high level. In this case, the noise immunity margin at the input is 50 mV. Unlike previous generation transceivers, the -50 and -200 mV thresholds correspond to the ±200 mV values ​​specified by the EIA/TIA-485 standard.

Hot-swappable

Literature

  1. Application note 4491, “Damage from a Lightning Bolt or a Spark–It Depends on How Tall You Are!”;
  2. Application note 5260, “Design Considerations for a Harsh Industrial Environment”;
  3. Application note 639, “Maxim Leads the Way in ESD Protection.”

All RS-485 devices are installed on one bus. The bus uses two lines for data ( A And B), while it is often convenient to also lay two lines for power supply - GND And +12V(or other supply voltage).

Wire A on all devices is connected to the terminal block marked A, wire B is always connected to B.

Twisted pair cable must be used: RS-485 data (lines A and B) must form a twisted pair. If the same cable is used to power devices, then it is necessary to pay attention to the cross-section of the conductors: a voltage drop on a long line can lead to the devices not working. Finally, you should choose a shielded cable.

When installing, it is convenient to use a cable with flexible cores. Examples are given below:

Name Flexible Conductor cross-section (mm^2) Pair twist Screen Approximate price, $/m Note
ParLan Patch F/UTP 4x2x0.60 Yes 0.2 Yes aluminum polymer tape 0.5 use two separate pairs for power supply
KSPEVG 2x2x0.35 Yes 0.35 Yes aluminum polymer tape 0.4 only on order
KDVEVG 2x2x0.50 Yes 0.5 Yes braid 1
KDVEVG 2x2x0.35 Yes 0.35 Yes braid 0.8
KIS-V 2x2x0.60 Yes 0.6 Yes braid 1.1

You can also use a regular CAT5 twisted pair for Ethernet to lay the bus - a standard connection diagram for it is given below (the typical characteristic impedance of such a cable is 100 Ohms).

Using a Category 5 network cable to lay the RS-485 bus
RS-485 bus signal The wire
data A white-green
data B green
power supply (12V or other) orange
power supply (12V or other) white-orange
not used blue
not used white-blue
power ground (GND) white-brown
power ground (GND) brown
When connecting external devices to the Wiren Board via the RS-485 bus, you need to connect not only data lines A and B, but also land(common wire) of the Wiren Board controller and external devices. Connecting a common wire is necessary when connecting to a non-isolated RS-485 port and is recommended when connecting to a galvanically isolated port.

The common terminal is designated, depending on the equipment, as SC, SG, G, GND, ground or reference. On Wiren Board controllers this terminal is designated GND. When connecting to an isolated port, you need to connect to the isolated ground of this port ("GND iso" terminals).

If your bus is longer than 100 meters, it is advisable to install a terminal resistor at its end (about 150 Ohms, more details on Wikipedia). For long lines, there are also recommendations to terminate unused cable conductors at both ends.

Connecting devices

Terminals for RS-485 bus

Wire A on all devices is connected to the terminal block marked A, wire B is always connected to B. On the Wiren Board, next to terminal blocks A and B, there are GND and Vout terminal blocks - you can immediately connect the power lines (check the power requirements of your devices first!).

Life hack: since there is a line stretch inside the Wiren Board, after connecting it to the bus, the voltage on line A will be approximately 0.5 V greater than on line B. Therefore, when connecting peripheral devices, you can easily determine the bus lines with a voltmeter. But, of course, color coding of conductors is preferable.

Additional Information

  1. The differential line provides good noise immunity. Line length up to 1200 meters.
  2. When laying a bus, you need to follow certain rules, but for transmission in one apartment, any cable is suitable and even branches are possible.






2024 gtavrl.ru.