Navigation :
Untitled Document
RS-232 "Specification and Standard"

In telecommunications, RS-232 is a standard for serial binary data interconnection between a DTE (Data terminal equipment) and a DCE (Data communication equipment). It is commonly used in computer serial ports. A similar ITU-T standard is V.24. RS is an abbreviation for "Recommended Standard".

Scope of the standard

The Electronic Industries Alliance (EIA) standard RS-232-C as of 1969 defines:

  • Electrical signal characteristics such as voltage levels, signaling rate, timing and slew-rate of signals, voltage withstand level, short-circuit behavior, maximum stray capacitance and cable length
  • Interface mechanical characteristics, pluggable connectors and pin identification
  • Functions of each circuit in the interface connector
  • Standard subsets of interface circuits for selected telecom applications
The standard does not define such elements as character encoding (for example, ASCII, Baudot or EBCDIC), or the framing of characters in the data stream (bits per character, start/stop bits, parity). The standard does not define bit rates for transmission, although the standard says it is intended for bit rates less than 20,000 bits per second. Many modern devices can exceed this speed (38,400 and 57,600 bit/s being common, and 115,200 and 230,400 bit/s making occasional appearances) while still using RS-232 compatible signal levels.

Limitations of the standard

Because the application of RS-232 has extended far beyond the original purpose of interconnecting a terminal with a modem, successor standards have been developed to address the limitations. Issues with the RS-232 standard include:

  • The large voltage swings and requirement for positive and negative supplies increases power consumption of the interface and complicates power supply design. The voltage swing requirement also limits the upper speed of a compatible interface.
  • Single-ended signalling referred to a common signal ground limit the noise immunity and transmission distance.
  • Multi-drop (meaning a connection between more than two devices) operation of an RS-232 compatible interface is not defined; while multi-drop "work-arounds" have been devised, they have limitations in speed and compatibility.
  • Asymmetrical definitions of the two ends of the link make the assignment of the role of a newly developed device problematical; the designer must decide on either a DTE-like or DCE-like interface and which connector pin assignments to use.
  • The handshaking and control lines of the interface are intended for the setup and takedown of a dial-up communication circuit; in particular, the use of handshake lines for flow control is not reliably implemented in many devices.
  • While the standard recommends a connector and pinout, the connector is large by current standards.

Role in modern computing

In the book "PC 97 Hardware Design Guide" [1], Microsoft deprecated support for the RS-232 compatible serial port of the original IBM PC design. Today, RS-232 is very gradually being superseded in personal computers by USB for local communications. Compared with RS-232, USB is faster, has lower voltage levels, and has connectors that are simpler to connect and use. Both protocols have software support in popular operating systems. USB is designed to make it easy for device drivers to communicate with hardware, and there is no direct analog to the terminal programs used to let users communicate directly with serial ports. However, USB is a more complex standard, requiring more software to support the protocol used. Serial ports of personal computers were also often used to directly control various hardware devices, such as relays or lamps, since the control lines of the interface could be easily manipulated by software. This isn't feasible with USB which requires some form of receiver to decode the serial data.


Many personal computers intended for office use ship with "legacy-free" motherboards without any RS-232 serial ports. However, RS-232 is still quite common in point-of-sale (cash drawers, barcode and magnetic stripe readers), amateur electronics and industrial measurement and remote-control devices, so computers made for such applications are still equipped with RS-232 ports. RS-232 was standard for so long that the circuits needed to control a serial port became very cheap and often exist on a single small microchip, sometimes together with circuitry for a parallel port. Many motherboards and desktop systems provide these ports even though they may not be used, simply because it costs the manufacturer very little to include them. Small-form-factor systems and laptops, however, often do not include them in order to conserve space. As an alternative, USB docking ports are available which can provide connectors for a keyboard, mouse, one or more serial ports, and one or more parallel ports. Corresponding device drivers are required for each USB-connected device to allow programs to access these USB-connected devices as if they were the original directly-connected peripherals.

Network equipment such as manageable switches and routers usually have an RS-232 port to be used for configuration of the device. It's a problem for some network administrators that most new laptops don't have an RS-232 port (though one can of course use a USB-to-serial dongle).

It is also possible to connect RS-232 devices via ethernet and WLAN device drivers, that act as network servers. Some manufacturers even have virtual serial port drivers available

RS232 bit streams

Communication as defined in the RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is not sent in predefined time slots. Data transfer can start at any given time and it is the task of the receiver to detect when a message starts and ends.


With synchronous communication, a clock or trigger signal must be present which indicates the beginning of each transfer. The absence of a clock signal makes an asynchronous communication channel cheaper to operate. Less lines are necessary in the cable. A disadvantage is, that the receiver can start at the wrong moment receiving the information. Resynchronization is then needed which costs time. All data received in the resynchronization period is lost. Another disadvantage is that extra bits are needed in the data stream to indicate the start and end of useful information. These extra bits take up bandwidth.

Data bits are sent with a predefined frequency, the baud rate. Both the transmitter and receiver must be programmed to use the same bit frequency. After the first bit is received, the receiver calculates at which moments the other data bits will be received. It will check the line voltage levels at those moments.

With RS232, the line voltage level can have two states. The on state is also known as marking, the off state as spacing. No other line states are possible. When the line is idle, it is kept in the marking state.

Start bit

RS232 defines an asynchronous type of communication. This means, that sending of a data word can start on each moment. If starting at each moment is possible, this can pose some problems for the receiver to know which is the first bit to receive. To overcome this problem, each data word is started with an attention bit. This attention bit, also known as the start bit, is always identified by the space line level. Because the line is in marking state when idle, the start bit is easily recognized by the receiver.

Data bits

Directly following the start bit, the data bits are sent. A bit value 1 causes the line to go in marking state, the bit value 0 is represented by a space. The least significant bit is always the first bit sent.

Parity bit

For error detecting purposes, it is possible to add an extra bit to the data word automatically. The transmitter calculates the value of the bit depending on the information sent. The receiver performs the same calculation and checks if the actual parity bit value corresponds to the calculated value.

Stop bits

Suppose that the receiver has missed the start bit because of noise on the transmission line. It started on the first following data bit with a space value. This causes garbled date to reach the receiver. A mechanism must be present to resynchronize the communication. To do this, framing is introduced. Framing means, that all the data bits and parity bit are contained in a frame of start and stop bits. The period of time lying between the start and stop bits is a constant defined by the baud rate and number of data and parity bits. The start bit has always space value, the stop bit always marking value. If the receiver detects a value other than marking when the stop bit should be present on the line, it knows that there is a synchronization failure. This causes a framing error condition in the receiving UART. The device then tries to resynchronize on new incomming bits.

For resynchronizing, the receiver scans the incomming data for valid start and stop bit pairs. This works, as long as there is enough variation in the bit patterns of the data words. If data value zero is sent repeatedly, resynchronization is not possible for example.

The stop bit identifying the end of a data frame can have different lengths. Actually, it is not a real bit but a minimum period of time the line must be idle (marking state) at the end of each word. On PC's this period can have three lengths: the time equal to 1, 1.5 or 2 bits. 1.5 bits is only used with data words of 5 bits length and 2 only for longer words. A stop bit length of 1 bit is possible for all data word sizes.



RS232 physical properties

The RS232 standard describes a communication method capable of communicating in different environments. This has had its impact on the maximum allowable voltages etc. on the pins. In the original definition, the technical possibilities of that time were taken into account. The maximum baud rate defined for example is 20 kbps. With current devices like the 16550A UART, maximum speeds of 1.5 Mbps are allowed

Voltage levels

The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level; logic one is defined as a negative voltage, the signal condition is called marking, and has the functional significance of OFF. Logic zero is positive, the signal condition is spacing, and has the function ON. The standard specifies a maximum open-circuit voltage of 25 volts; signal levels of ±5 V, ±10 V, ±12 V, and ±15 V are all commonly seen depending on the power supplies available within a device. Circuits driving an RS-232-compatible interface must be able to withstand indefinite short circuit to ground or to any voltage level up to 25 volts. The slew rate, or how fast the signal changes between levels, is also controlled.

Connectors

RS-232 devices may be classified as Data Terminal Equipment (DTE) or Data Communications Equipment (DCE); this defines which wires will be sending and receiving each signal. The standard recommended but did not make mandatory the common D-subminiature 25 pin connector. In general, terminals have male connectors with DTE pin functions, and modems have female connectors with DCE pin functions. Other devices may have any combination of connector gender and pin definitions.

Presence of a 25 pin D-sub connector does not necessarily indicate an RS-232C compliant interface. For example, on the original IBM PC, a male D-sub was an RS-232C DTE port (with a non-standard current loop interface on reserved pins), but the female D-sub connector was used for a parallel Centronics printer port. Some personal computers put non-standard voltages or signals on their serial ports.

The standard specifies 20 different signal connections. Since most devices use only a few signals, smaller connectors can be used. For example, the 9 pin DE-9 connector was used by most IBM-compatible PCs since the IBM PC AT, and has been standardized as TIA-574. More recently, 8 pin RJ-45 connectors have become common, although pin assignments vary widely. Standard EIA/TIA 561 specifies a pin assignment, but the "Yost Serial Device Wiring Standard" invented by Dave Yost is common on Unix computers. Many devices don't follow either of these; routers from Cisco Systems have different signals on pins 1 and 8. 10 pin RJ-50 connectors can be found on some devices as well. Digital Equipment Corporation defined their own DECconnect connection system which was based on the Modified Modular Jack connector. This is a 6 pins modular jack where the key is offset from the center position. As with the Yost standard, DECconnect uses a symmetrical pin layout which enables the direct connection between two DTEs.


Pinouts (DTE relative)

The following table lists the commonly used RS-232 signals and common pin assignments (see also RS-485 for different standard with the same connectors):

Signal DB-25 DE-9 (TIA-574) EIA/TIA 561 Yost RJ-50 MMJ
Common Ground 7 5 4 4,5 6 3,4
Transmitted Data (TD) 2 3 6 3 8 2
Received Data (RD) 3 2 5 6 9 5
Data Terminal Ready (DTR) 20 4 3 2 7 1
Data Set Ready (DSR) 6 6 1 7 5 6
Request To Send (RTS) 4 7 8 1 4 -
Clear To Send (CTS) 5 8 7 8 3 -
Carrier Detect (DCD) 8 1 2 7 10 -
Ring Indicator (RI) 22 9 1 - 2 -

The signals are labeled from the standpoint of the DTE device; TD, DTR, and RTS are generated by the DTE and RD, DSR, CTS, DCD, and RI are generated by the DCE. The ground signal is a common return for the other connections; it appears on two pins in the Yost standard but is the same signal. Connection of pin 1 (protective ground) and pin 7 (signal reference ground) is a common practice but not recommended. Use of a common ground is one weakness of RS-232. If the two pieces of equipment are far enough apart or on separate power systems, the ground will degrade between them and communications will fail; this is a difficult condition to trace.

Note that EIA/TIA 561 combines DSR and RI, and the Yost standard combines DSR and DCD.

Cables

Cable length is one of the most discussed items in RS232 world. The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet.


The cable length mentioned in the standard allows maximum communication speed to occur. If speed is reduced by a factor 2 or 4, the maximum length increases dramatically. Texas Instruments has done some practical experiments years ago at different baud rates to test the maximum allowed cable lengths. Keep in mind, that the RS232 standard was originally developed for 20 kbps. By halving the maximum communication speed, the allowed cable length increases a factor ten!

RS232 cable length according to Texas Instruments
Baud rate Maximum cable length (ft)
19200 50
9600 500
4800 1000
2400 3000

Since the standard definitions are not always correctly applied, it is often necessary to consult documentation, test connections with a breakout box, or use trial and error to find a cable that works when interconnecting two devices. Connecting a fully-standard-compliant DCE device and DTE device would use a cable that connects identical pin numbers in each connector (a so-called "straight cable"). "Gender changers" are available to solve gender mismatches between cables and connectors. Connecting devices with different types of connectors requires a cable that connects the corresponding pins according to the table above. Cables with 9 pins on one end and 25 on the other are common, and manufacturers of equipment with RJ-45 connectors usually provide a cable with either a DB-25 or DE-9 connector (or sometimes interchangeable connectors so they can work with multiple devices).

Connecting two DTE devices together requires a null modem that acts as a DCE between the devices by swapping the corresponding signals (TD-RD, DTR-DSR, and RTS-CTS). This can be done with a separate device and two cables, or using a cable wired to do this. One feature of the Yost standard is that a null modem cable is a "rollover" cable that just reverses pins 1 through 8 on one end to 8 through 1 on the other end.

For configuring and diagnosing problems with RS-232 cables, a "breakout box" may be used. This device normally has a female and male RS-232 connector and is meant to attach in-line; it then has lights for each pin and provisions for interconnecting pins in different configurations.

RS-232 cables may be built with connectors commonly available at electronics stores. The cables may be between 3 and 25 pins; typically 4 or 6 wires are used. Flat RJ (phone-style) cables may be used with special RJ-RS232 connectors, which are the easiest to configure.

The reason that a minimal two-way interface can be created with only 3 wires is that all the RS-232 signals share a common ground return. The use of unbalanced circuits makes RS-232 susceptible to problems due to ground potential shifts between the two devices. RS-232 also has relatively poor control of signal rise and fall times, leading to potential crosstalk problems. RS-232 was recommended for short connections (15 meters or less). RS-232 interface cables are not usually constructed with twisted pair because of the unbalanced circuits.

While the control lines of the RS 232 interface were originally intended for call setup and takedown, other "handshakes" may be required by one or the other device. These are used for flow control, for example, to prevent loss of data sent to a serial printer. For example, DTR is commonly used to indicate "device ready". Pins may also be "jumpered" or routed back within the connector. For example a pin saying "are you ready?" from device A might be wired to the pin saying "I'm ready" on device A if device B did not transmit such a signal. Common handshake pins are DTR, DSR, DCD, and RTS/CTS.

Error detection

One way of detecting errors is already discussed. It is the frame detection mechanism which is used to test if the incomming bits were properly surrounded by a start and stop bit pair. For further error checking, a parity bit can be used. The use of this bit is however not mandatory. If the existence of wrong bits is rare (when communicating with an internal modem for example) or if a higher level protocol is used for error detection and correction (Z-modem, RAS, etc) communication speed can be increased by not using the parity feature present on the UART.

Parity is a simple way to encode a data word to have a mechanism to detect an error in the information. The method used with serial communications adds one bit to each data word. The value of this bit depends on the value of the data word. It is necessary that both the transmitter and receiver use the same algorithm to calculate the value of the parity bit. Otherwise, the receiver may detect errors which are not present.

Even parity

Basically, the parity bit can be calculated in two ways. When even parity is used, the number of information bits sent will always contain an even number of logical 1's. If the number of high data bits is odd, a high value parity bit is added, otherwise a low bit will be used.

Odd parity

The odd parity system is quite similar to the even parity system, but in this situation, the number of high bits will always be odd.

Disadvantages of the parity system

The parity system using one bit for each data word is not capable of finding all errors. Only errors which cause an odd number of bits to flip will be detected. The second problem is, that there is no way to know which bit is false. If necessary, a higher level protocol is necessary to inform the sender that this information must be resent. Therefore, on noisy lines, often other detection systems are used to assure that the sent information is received correctly. These systems mostly do not operate on single data words, but on groups of words. Known coding systems are:
  • Hamming coding
  • CRC16 cyclic redundancy check
  • CCITT-16 cyclic redundancy check
  • CRC-DNP cyclic redundancy check
  • CRC32 cyclic redundancy check

Related standards

Other serial signalling standards may not interoperate with standard-compliant RS-232 ports. For example, using the TTL levels of +5 and 0 V puts the mark level in the undefined area of the standard. Such levels are sometimes used with NMEA-compliant GPS receivers and depth finders.

20 mA current loop uses the absence of 20 mA current for high, and the presence of current in the loop for low; this signaling method is often used for long-distance and optically isolated links. Connection of a current-loop device to a compliant RS-232 port requires a level translator; current-loop devices are capable of supplying voltages in excess of the withstand voltage limits of a compliant device. However, the original IBM XT serial port card implemented a 20 mA current-loop interface, which was never emulated by other suppliers of plug-compatible equipment.

Other serial interfaces similar to RS-232:

  • RS-422 (a high-speed system similar to RS-232 but with differential signalling)
  • RS-423 (a high-speed system similar to RS-422 but with unbalanced signalling)
  • RS-449 (a functional and mechanical interface that used RS-422 and RS-423 signals - it never caught on like RS-232 and was withdrawn by the EIA)
  • RS-485 (a descendant of RS-422 that can be used as a bus in multidrop configurations)
  • MIL-STD-188 (a system like RS-232 but with better impedance and rise time control)
  • EIA-530 (a high-speed system using RS-422 or RS-423 electrical properties in an EIA-232 pinout configuration, thus combining the best of both; supersedes RS-449)
  • TIA-574 (standardizes the 9-pin D-subminiature connector pinout for use with EIA-232 electrical signalling, as originated on the IBM PC/AT)

References

  1. Electronics Industries Association, "EIA Standard RS-232-C Interface Between Data Terminal Equipment and Data Communication Equipment Employing Serial Data Interchange", August 1969, reprinted in Telebyte Technology "Data Communication Library" Greenlawn NY, 1985, no ISBN
  2. "PC 97 Hardware Design Guide", 1997, Microsoft Press, Redmond Washington USA, ISBN 1572313811
  3. TIA Web site
  4. Application Note 83 published by Dallas Semiconductor—now merged with Maxim—which describes in human readable language all aspects of the RS-232 interface.( Maxim -1998 )
  5. Application Report SLLA067A published by Texas Instruments about all kinds of practical physical aspects of currently available interface methods, including a line length vs. communication speed graph. ( Texas Instruments - 2004 ) 
Last modified at : Thursday, December 11st 2008 14:02:13.
Home
Bahasa Indonesia
122380 Times
1 online
Only a life lived for others is a life worth while.

Albert Einstein

Administrator srugN - Electronic Engineering Polytechnic Institute of Surabaya