Dozens of serial data interfaces are used today. Most have been developed for specific applications. A few have become universal, such as I2C, CAN, LIN, SPI, Flex, MOST, and I2S. Then there’s Ethernet and USB and other higher-speed serial interfaces like FireWire, HDMI, and Thunderbolt. Two of the oldest interfaces are RS-232 and RS-485. These legacy interfaces aren’t obsolete or discontinued, though. Both are still alive and well in many applications.
The whole purpose of a serial interface is to provide a single path for data transmission wirelessly or over a cable. Parallel buses are still used in some applications. But with high-speed data so common today, a serial interface is the only practical option for communications over any distance greater than several feet.
Serial interfaces can be used to provide standardized logic levels from transmitters to receivers, define the transmission medium and connectors, and specify timing and data rates. In some cases, they can perform serial-to-parallel and parallel-to-serial conversion or specify a basic data protocol.
The definition of logic levels, medium, and connectors is part of the physical layer (PHY) or layer 1 of the Open Systems Interconnection (OSI) networking model. Any additional functions such as data handling is part of the media access control (MAC) layer or layer 2 of the OSI model.
One of the oldest serial interfaces is generically called RS-232. It was originally 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 computers included an RS-232 called a serial port for connection to a printer or other peripheral device. Today, it is still widely used in embedded computer development systems, scientific instruments, and all sorts of industrial control equipment.
The official name of the standard is Electronic Industries Association/Telecommunications Industries Association EIA/TIA-232-F. The letter F designates the most recent standard modification and update. The standard is essentially the same as the International Telecommunications 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 (Fig. 1). Signal levels are commonly referred to as a mark for logic 1 and a space for logic 0. Voltages between ±3 V are invalid, providing a huge noise margin for the interface. Noise voltages in this range are rejected. In common practice, logic 0 and 1 levels are typically as low as ±5 V and as high as ±12 or ±15 V. The transmitter and receiver configurations are single-ended (not differential) with a ground reference.
The cable medium can be simple parallel wires or twisted pair. The length of the cable determines the upper data rate and generally should not exceed 50 feet. However, much longer cable lengths can be used with low data rate conditions. Today the primary goal is to use a cable with no more than 2500 pF of capacitance between wires. This limits the upper data rate to roughly 20 kbits/s. Because of the low-speed data rates used with this interface, the cable generally isn’t treated as a formal transmission line. Transmission lines require matched generator and load impedances to eliminate reflections that cause data corruption.
The standard defined a 25-pin connector called the DB-25, which was designed to carry a variety of control lines as well as the serial data transmit and receive lines. Such connectors are rarely used today. Instead, a nine-pin connector called the DE-9 was defined, and today it is the de facto standard (Fig. 2).
Originally, data rates for electromechanical equipment were very slow. A minimum rate was typically 75 bits/s, but rates of 150 and 300 bits/s were common. Today, data rates are defined by the protocol used with the interface and can range as high as 115.2 kbits/s. Typical data rates are 1200, 2400, 4800, 9600, 19,200, 38,400, and 115,200 bits/s. The data rate is limited by the maximum allowed slew rate of 30 V/µs (volts per microsecond). For short low-capacitance cables, data rates can be as high as several megabits per second with the appropriate drivers.
Many RS-232 connections are one-way or simplex. However, using the special signaling and control voltages available, two-way or half-duplex operation is possible. The two connected devices alternate transmitting and receiving operations.
The control signals in the interface define the protocol for transmitting and receiving data. These signals tell the two communicating devices when they are busy, transmitting, ready, and receiving. The transmitting device is the DTE such as a computer, and the receiving device is the DCE such as a printer. The control signals used on the common nine-pin connector are:
- Data carrier detect (DCD): The DCE tells the DTE it is receiving a valid input signal.
- Data set ready (DSR): The DCE tells the DTE it is connected and ready to receive.
- Received data (RD): This is the actual signal received from the DTE.
- Request to send (RTS): This signal from the DTE tells the DCE it is ready to transmit.
- Transmit data (TD): This is the transmitted signal from the DTE.
- Clear to send (CTS): This line from the DCE tells the DTE it is ready to receive data.
- Data terminal ready (DTR): This line is from the DTE to the DCE indicating readiness to send or receive data.
- Ring indicator (RI): This line was used in older modem connections but isn’t used anymore.
- Signal ground: This is the common ground connection for all signals.
Figure 3 shows the cable connections from the DTE to the DCE. Note the interconnections between the control line pins. The signals on these pins occur in response to one another in what is called a flow control or “handshaking” process.
Although not formally part of the RS-232 standard, most serial devices using the interface also use what is called a universal asynchronous receiver transmitter (UART). This IC, usually separate from the line driver and receiver circuits, implements a basic communications protocol that involves transmitting up to 8 bits at a time. It performs serial-to-parallel and parallel-to-serial conversion, adding start and stop bits to signal the beginning and end of a data word, parity bit error detection, and establishment of the data rate.
The data is often ASCII characters, but any data word up to 8 bits can be transmitted (Fig. 4). The UART can usually 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/s to 115.2 kbits/s are selectable.
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 communications bus that can be used to form simple networks of multiple devices. Its configuration and specifications also extend the range and data rate beyond the RS-232 interface capabilities.
The RS-485 standard specifies differential signaling on two lines rather than single-ended with a voltage referenced to ground. A logic 1 is a level greater than –200 mV, and a logic 0 is a level greater than +200 mV. Typical line voltage levels from the line drivers are a minimum of ±1.5 V to a maximum of about ±6 V. Receiver input sensitivity is ±200 mV. Noise in the range of ±200 mV is essentially blocked. The differential format produces effective common-mode noise cancellation.
The standard transmission medium is twisted-pair cable of either #22 or #24 AWG solid wire. Two lines are minimum but a third reference wire can be used. Four-wire cables can also be used if full-duplex operation is desired. The cables may be shielded or unshielded, with unshielded the most common. The cable is treated as a transmission line. The nominal characteristic impedance is 100 or 120 Ω. Terminating load resistors are required to ensure a matched line condition, which prevents reflections that introduce data errors.
The standard does not define specific connectors. Various connection methods have been used, including the RS-232 DE-9 connector. Simple screw terminal connections are common in some types of industrial control equipment.
Cable length defines the upper data rate. But because of the lower logic voltage levels and the differential connection, data rates can exceed 10 Mbits/s depending on cable length. Maximum cable length is commonly defined as 1200 meters or about 4000 feet. The typical maximum data rate at 4000 feet is 100 kbits/s. A general guideline is that the product of the length of the line in meters and the data rate in bits per second should not exceed 108. A 20-meter cable, for example, would allow a maximum data rate of 5 Mbits/s.
The RS-485 interface can be used in simplex of half-duplex modes with a single-pair cable. Full-duplex or simultaneous transmit and receive operations can be implemented with a two-pair cable. A common configuration is bus network with multiple drops or connections. The standard specifies a maximum of 32 drivers (transmitters) and 32 receivers (Fig. 5). Line drivers are disconnected from the line when not transmitting. All receivers are fully connected, and the bus line is terminated in a load matching resistance.
The standard has not defined a specific communications protocol. The standard UART protocol is sometimes used. Most applications define a unique protocol.
Several variations of these two standards are occasionally found in practice. RS-422 is a variation of RS-485 with similar specifications but is designed only for one driver and up to 10 receivers. Logic levels range from ±2 to ±6 V. RS-423 is a single-ended rather than differential variation of RS-422. Otherwise, other specifications are similar to the RS-485 interface.
The TIA-232 standard is currently deployed in a wide range of low-data-rate short-range applications. It is particularly effective in equipment used in noisy environments such as factories, process control plants ,and utilities sites. Cable lengths are typically less than 50 feet. Common equipment includes low-speed modems, industrial control equipment like 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 where higher speeds and longer distances are needed. It is used in the same type of equipment as defined for the RS-232 interface plus devices like point of sale (POS) terminals, metering instruments, and large special automated machines. Networks defined by field buses like Profibus and Modbus use it as well.
Most new equipment uses the popular USB interface. However, it is often necessary or desirable to convert from one interface to another to allow different types or ages of equipment to be used together. Various converters are available to convert USB to TIA-232 or TIA-485, TIA-232 to TIA 485, or vice versa.
In general, the RS-232 is best for short-distance low-speed requirements. It is simple and low cost, and plenty of components like line drivers and receivers, UARTs, and connectors are available to build the interface. Some drivers permit data rates to 2 or 3 Mbits/s for short lines. Most interface chips include a charge pump dc-dc converter that supplies the positive and negative supply voltages allowing the IC to operate from a single 3.3- or 5-V supply.
The RS-485 is for higher speeds over longer ranges or if duplex networking capability is required. Again, many standard parts are available to create the interface. ICs have drivers and receivers that can permit more than 32 drops, and data rates can be as high as 40 Mbits/s. Some ICs also include dc-dc converters to furnish dual supply voltages (see the table).