Since the advent of the USB interface, the number of serial devices and serial ports on the host computer has been reduced, but the serial interface is still widely used in industrial networking environments or commercial projects. Dozens of serial data interfaces are in use today. Most have been developed for specific applications. Some have become common, such as I2C, CAN, LIN, SPI, soft and hard, MOST, I2S.There are higher speed serial interfaces such as Ethernet, HDMI and Thunderbolt. The two most classic interfaces are RS232 and RS485. The reason why these long-circulated Ethernet interfaces have been used all the time is that they must have the value of existence. So what is the principle of RS485 and RS232? What's the difference? What value will make them last?
The entire purpose of a serial interface is to provide a single path for data transfer, either wirelessly or over a cable. Parallel buses are still used in some applications. But for the high-speed data so prevalent today, serial servers are the first practical choice for robust communication over any distance greater than a few kilometers.
Serial interfaces can be used to provide standardized logic levels from transmitter to receiver, define transmission media and connectors, and specify timing and data rates. In some cases, they can perform serial-to-parallel and parallel-to-serial conversion, or specify basic data protocols.
The definition of logical levels, media, and connectors is part of the Physical Layer (PHY) or Layer 1 of the Open Systems Interconnection (OSI) network model. Any other functions such as data processing are part of the Media Access Control (MAC) layer, or Layer 2, of the OSI model.
RS232 serial port
One of the oldest serial interfaces is commonly known as RS232. It was first established in 1962 as a method of connecting data terminal equipment (DTE), such as electromechanical teletypewriters, to data communications equipment (DCE). Over the years, its use has included connections to video terminals, computers, and modems. The first personal computer included an RS232, called a serial port, to connect a printer or other peripheral device. Today, it is still widely used in embedded computer development systems, scientific instruments, and various industrial control devices.
The official name of the standard is Electronic Industries Association/Telecommunications Industry Association EIA/TIA-232-F. The letter F indicates the latest standard modifications and updates. This standard is basically the same as the International Telecommunication Union–Telecommunications (ITU-T) specifications V.24 and V.28.
The standard defines a logic 1 and a voltage between–3 and–25 V, and a logic 0 as a voltage level between + 3 and + 25 V (Figure 1). The signal level is commonly referred to as a logic 1 flag and a logic 0 interval. Voltages between±3 V are not available, providing significant noise margin for the interface. Noise voltages in this range are rejected. In common practice, logic 0 and 1 levels are often as low as±5 V and as high as±12 or±15 V. The transmitter and receiver are configured as single-ended (non-differential) with a ground reference.
1. The voltage level defines a logical 1 or flag and a logical 0 or space character. Voltage between±3 V is not valid.
The cable medium may be a simple parallel wire or a twisted pair. The length of the cable determines the higher data rate and should generally not exceed 50 feet. However, longer cable lengths can be used at lower data rates. The main goal today is to use cables with no more than 2500 pF capacitance between wires. This limits the upper data rate to about 20 kbits/s.Because of the low data rate used by this interface, the cable is not usually considered a formal transmission line. The transmission line requires matched generator and load impedances to eliminate reflections that cause data corruption.
The standard defines a 25-pin connector called the DB-25, which is designed to carry various control lines as well as serial data send and receive lines. This connector is rarely used today. Instead, a 9-pin connector called DE-9 is defined.
2. The popular DB9 connector carries the signal shown. These numbers are the pin numbers on the connector.
Initially, the data rate of the mechatronic device is very slow. The lowest rate is typically 75 bits/sec, but 150 and 300 bits/sec are common. Today, the data rate is defined by the protocol used by the interface and ranges up to 115.2 kbit/s. Typical data rates are 1200, 2400, 4800, 9600, 19,200, 38,400, and 115,200 bits/second. The data rate is limited by the maximum allowable slew rate of 30 V/µs (volts per microsecond). For short, low-capacitance cables, data rates of up to several megabits per second can be achieved with appropriate drivers.
Many RS-232 connections are unidirectional or simplex. However, bidirectional or half-duplex operation is possible using the special signals and control voltages available. Two connected devices alternate between transmit and receive operations.
The control signals in the interface define the protocol used to send and receive data. These signals tell both communication devices when they are busy, transmitting, ready, and receiving. The sending device is the DTE (for example, a computer) and the receiving device is the DCE (for example, a printer). The control signals used on the common nine-pin connector are:
Data Carrier Detection (DCD): The DCE tells the DTE that it is receiving a valid input signal.
Data Set Ready (DSR): The DCE tells the DTE that it is connected and ready to receive.
Receive Data (RD): This is the actual signal received from the DTE.
Request to Send (RTS): This signal from the DTE tells the DCE that it is ready to send.
Transmit Data (TD): This is the signal sent by the DTE.
Clear to Send (CTS): This line on the DCE tells the DTE that it is ready to receive data.
Data Terminal Ready (DTR): This line goes from the DTE to the DCE and indicates that it is ready to send or receive data.
Ring Indicator (RI): This line was used on older modem connections, but is no longer used.
Signal Ground: This is the common ground for all signals.
3. This is a common connection between DTE and DCE devices. Note the connection of the cable from one connector to the other.
Although not officially part of the RS-232 standard, most serial devices that use this interface also use what is known as a universal asynchronous receiver transmitter (UART). The IC, usually separate from the line driver and receiver circuits, implements a basic communication protocol that transmits up to 8 bits at a time. It performs serial-to-parallel and parallel-to-serial conversions, adds start and stop bits to indicate the start and end of a data word, parity bit error detection, and data rate establishment.
The data is usually ASCII characters, but any data word up to 8 bits can be transmitted (Figure 4). UARTs can typically be configured to handle different word sizes (5 to 8 bits), add 1, 1.5, or 2 stop bits, and include odd, even, or no parity bits. Data rates from 75 bits/sec to 115.2 kbit/s are optional.
RS-485
Also defined by the EIA/TIA standard, this interface is now called TIA-485. It defines not only a single device-to-device interface, but also a communication bus that can be used to form a simple network of multiple devices. Its configuration and specifications also extend the range and data rates beyond the capabilities of the RS-232 interface.
The RS-485 standard specifies differential signaling on both lines, not single-ended with a reference voltage to ground. The logic 1 level is greater than–200 mV and the logic 0 level is greater than + 200 mV. Typical line voltage levels from the line driver range from a minimum of±1.5 V to a maximum of approximately±6 V. The receiver input sensitivity is±200 mV. Noise in the±200 mV range is essentially blocked. The difference scheme produces effective common mode noise cancellation.
The standard transmission medium is a twisted pair cable of # 22 or # 24 AWG solid wire. Minimum of two lines, but a third reference line may be used. If full duplex operation is required, a four-wire cable can also be used. Cables can be shielded or unshielded, with unshielded being the most common. Cables are considered transmission lines. The nominal characteristic impedance is 100 or 120Ω. The use of a terminating load resistor is required to ensure a matched line condition to prevent reflections from introducing data errors.
The standard does not define a specific connector. Various connection methods have been used, including RS-232 DE-9 connectors. Simple screw terminal connections are common in some types of industrial control equipment.
The cable length defines the higher data rate. However, due to the lower logic voltage levels and differential connections, the data rate can exceed 10 Mbits/s depending on the cable length. The maximum cable length is generally defined as 1200 meters or about 4000 feet. The typical maximum data rate at 4000 feet is 100 kbits/s. As a general guideline, the product of the line length in meters and the data rate in bits per second should not exceed 108. For example, a 20-meter cable will allow a maximum data rate of 5 Mbit/s.
The RS-485 interface can be used in half-duplex, simplex mode over a single pair of cables. Two pairs of cables can be used for full duplex or simultaneous transmit and receive operation. A common configuration is a bus network with multiple branches or connections. The standard specifies a maximum of 32 drivers (transmitters) and 32 receivers (Figure 5). When not transmitting, the line driver is disconnected from the line. All receivers are fully connected and the bus is terminated with load matching resistors.
5. This is a representation of a typical TIA-485 differential bus showing the individual drivers (D) and receivers (R) and transceivers. Note the end of the bus termination resistor.
The standard does not yet define a specific communication protocol. Sometimes the standard UART protocol is used. Most applications define a unique protocol.
Interface changes
Several variations of these two criteria are occasionally found in practice. RS-422 is a variant of RS-485 with similar specifications, but is designed for only one driver and up to 10 receivers. The logic levels range from±2 to±6 V. RS-423 is a single-ended, not differential, version of RS-422. Otherwise, the other specifications are similar to the RS-485 interface.
Field of application
Today, the TIA-232 standard is deployed in a variety of low data rate, short range applications. It is particularly effective in equipment used in noisy environments, such as factories, process control plants, and utility sites. Cable lengths are typically less than 50 feet. Common devices include low-speed modems, industrial control devices such as programmable logic controllers (PLCs), computer numerically controlled (CNC) machine tools, robots, embedded control computers, medical instruments and equipment, and embedded controller development systems.
The TIA-485 interface is also widely used in industrial applications that require higher speeds and longer distances. It is used for devices of the same type as those defined by the RS-232 interface, as well as for devices such as point-of-sale (POS) terminals, metering instruments, and large purpose-built automated machines. It is also used by networks defined by fieldbuses such as Profibus and Modbus.
Most new devices use the popular USB interface. However, it is often necessary or desirable to convert from one interface to another to allow devices of different types or ages to be used together. Various converters can be used to convert USB to TIA-232 or TIA-485, TIA-232 to TIA 485, and vice versa.
https://zhuanlan.zhihu.com/p/552134754
https://zhuanlan.zhihu.com/p/552134754