From simple analog communication over the telephone wires to the typical USB cables for data exchange, we have come a long way in the field of communication. RS232 was the first milestone reached in this journey. It was a standard for electromechanical typewriters and modems for digital data exchange introduced in 1962 by the Radio Sector of EIA. It made the data exchange more reliable over analog channel. The standard defined voltage levels that made it immune to noise disturbances and reduced the error in data exchange.
As the technology was growing many electronic devices were being developed during this time like computers, printers, test instrument etc. There came a time where manufacturers felt the need to exchange information between these electronic devices. For example data exchange between a computer and a printer or two computers. But there was no standard or method to accomplish this task. RS232 was the only available standard at the time which was used for data exchange. So, they thought of adopting this standard in electronic devices for digital data exchange. But the standard was unable to fulfill the requirements as it was developed specifically for modem and teletypewriter. T
o overcome this problem, designers started implementing an RS232 interface compatible to their equipments. Like a computer of HP will only be able to use HP peripheral devices. Because of this the market was flooded with different manufactures with their own standards for their devices. This led to the common problems like non-standard pin assignment of circuits on connectors, and incorrect or missing control signals. The lack of adherence to the standard produced a thriving industry of breakout boxes, patch boxes, test equipments, books and other aids for the connection of dissimilar equipments. So, to put an end to all theses disparities in equipments, syndicate of manufacturers built a transmitter that supplied +5V and -5v and labeled them as “RS-232” compatible and they are same till date. The standard has been revised many times after the initial one and updated by Electronic industries association. The name of standard was also changed from RS232 to EIA232. The Electronic Industries Association published three modifications, the most recent being EIA232F introduced in 1997.
What is RS232 – “RECOMMENDED STANDARD 232”
RS-232 is a standard communication protocol for linking computer and its peripheral devices to allow serial data exchange. In simple terms RS232 defines the voltage for the path used for data exchange between the devices. It specifies common voltage and signal level, common pin wire configuration and minimum, amount of control signals. As mentioned above this standard was designed with specification for electromechanically teletypewriter and modem system and did not define elements such as character encoding, framing of characters, error detection protocols etc that are essential features when data transfer takes place between a computer and a printer. Without which it could not be adopted to transfer data between a computer and a printer. To overcome this problem a single integrated circuit called as UART known as universal asynchronous receiver/transmitter is used in conjunction with RS232.
This is how the entire arrangement works.
Fig. 1: Diagram Explaing Serial Data Exchange Between PC and Device Using RS232 Protocol
It is clear from this figure that UART, line drivers and RS232 are three separate parts in the system each having its own characteristic features. UART and line drivers are the parts in RS232 to enhance quality of system during serial data exchange.
A standard definition was given by EIA to define RS232 as “an interface between Data terminal equipment and Data communication equipment”. A typical RS232 system is shown below.
Fig. 2: Image Explaining a Typical RS232 System
DTE-A DTE stands for data terminal equipment is an end instrument that convert user information into signals or reconverts the receive signal. It is a functional unit of station that serves as data source or data sink and provides for communication control function according to the link protocol. A male connector is used in DTE and has pin out configuration.
DCE-A DCE stands for data communication equipments. It sits between the DTE and data transmission circuit for example modem. A DCE device uses a female connector which has holes on the surface to hold male connector.
A minimum of three signals are required for communication between a DTE and a DCE devices. These signals are a transmission line, a reception line and ground. These two devices communicate with each other by handshaking. It allows a DTE and a DCE device system to acknowledge each other before sending the data.
Handshaking is a process in which a DTE device sends a signal to a DCE device to establish a connection between the devices before the actual transfer of data. It sets the parameters of communication channel established between two equipments before normal communication over the channel begins. It follows physical establishment of the channel and precedes normal information transfer. Handshaking makes it possible to connect relatively heterogeneous systems or equipment over a communication channel without the need for human intervention to set parameters. This same concept is used in RS232 to allow two devices communicate with each other before the actual exchange of information.
All these terms put together gives a complete picture of a RS232 system starting from DTE to DCE with UART, line drivers and RS232 as conjunction between them.
Implementation & Specifications
Implementation of RS232 standard
Fig. 3: Block Diagram Explaining Implementation of RS232 in Devices
The RS-232 interface works in combination with UART universal asynchronous receiver/transmitter. It is a piece of integrated circuit integrated inside the processor or controller. It takes bytes and transmits the individual bits in a sequential fashion in a frame. A frame is defined structure, carrying meaningful sequence of bit or bytes of data. It has a start bit followed by 8 data bits, a parity bit and a stop bit. Once data is changed into bits separate line drivers are used to convert the logic level of UART to RS-232 logic. Finally the signals are transferred along the interface cable at the specified voltage level of RS-232. The data is sent serially on RS232. Each bit is sent one after the other. T
his mode of transmission requires that receiver is aware when the actual data bits are arriving to synchronize itself with coming data. So logic 0 is sent as a start bit. The start bit in the frame signals the receiver that a new character is coming. Once the receiver acknowledges the next five to eight bits are sent which represents the character. This is followed by parity bit used for error detection. Parity bit is used to specify even or odd number of one’s in the set of bits. For error detection we add an extra bit to the data word. The transmitter calculates the value of the bit depending on the information sent and receiver also performs the same calculation. It checks the parity value to the calculated value. The stop bit helps the receiver to identify the end of message. The start bit always has space value and stop bit has mark value. Now, if a receiver detects a value other than mark when stop bit should be present, it knows that’s there is synchronization error. This causes a framing error condition in the receiving UART. The device then tries to resynchronize on new incoming bits. At the other end again the line driver interface converts it into UART compatible logic levels. At the destination, a second UART re-assembles the bits into bytes. This is how RS232 made the data exchange compatible and reliable.
Standard RS232 specifications
RS 232 is known as a complete standard. It ensures perfect compatibility by defining not only electrical characteristics but also functional and mechanical. For example voltage levels, slew rate, signaling rate, pluggable connector, pin identification etc. All the specifications are summarized in this block diagram with their values and examples.
Fig. 4: Block Diagram Summarizing Standard RS232 Specifications
This section deals with detailed understanding of each characteristic on the standard.
It includes specifications on voltage levels; slew rate and voltage withstand level. RS232 pin out signals are represented by voltage levels with respect to common. It specifies maximum circuit voltage as 25v. At the transmitter side ,driver output specifies voltage +3v to +15v as high level and -3v to -15v for low level. In the same way for the receiver output high level for voltage is +3v to +15v and low level voltage is -3v to -15v. It should be known that the receiver logic provides the +2v noise margin. The dead area between +3v and -3v is designed to absorb line noise. In RS232 specification low level -3v to-15v is defined as logic ‘1’ is ON state and referred as ‘Marking’ while high level +3v to +15v is defined as logic ‘0’ as OFF state and known as ‘Spacing’. The RS232 standard also limits the maximum slew rate which reduces the cross-talk between the two signals. Slew rate is defined as the rate of change of out-put voltage with respect to time. The maximum allowable slew rate in RS232 is 30v/micro-seconds which slows down the rise and fall time and reduces the cross-talk. 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. Some computer equipment ignores the negative level and accepts a zero voltage level as the OFF state. The output signal level usually swings between +12V and -12V.
RS232 logic specification figure
Fig. 5: Graph Showing Electrical Characteristics in RS232
This area concerns with the mechanical interface.
A standard 25 pin connector was used initially. It specified the minimum connector size that can accommodate all the signals. Each pin has been pre- defined to allow the compatibility between the host and the peripheral systems .The data terminal equipment uses male connector and data communication equipment uses female connector pins. Another important concept related to connector is type of gender. In electrical and mechanical trade each connector comes in a pair. One is male connector and other is female. Male connectors have pin sticking out on the surface while female connectors have holes on them to hold the male connector. In RS232 also, DTE have male D-25 connectors while DCE have female D-25 connectors. A combination of D-SUB 25 MALE and D-SUB 25 FEMALE connector is used two connect a DTE and DCE by specifying common voltage and signal level, common pin wire configuration and minimum amount of control signals.
Fig. 6: Images of D-SUB 25 MALE Connector in RS232 Based Systems
A 25- position connector was widely used but nowadays it is a 9 pin connector which is used in many applications. It is quite sufficient in most circumstances as many of the lines available on RS232 25 pin connector are rarely used. The 9 way connector is able to provide all the required connectivity for most applications and allows the application to transmit and receive the necessary signals as per the requirements.
A 25 –pin and a 9-pin connector is shown below.
Fig. 7: Pin numbers in 25-Pin and 9-Pin connector
This is the third area that concerns with the RS232 specification. It defines the functions of different signals that are used in the interface. These signals are defined in four categories as data, common, control and timing. There are few terms used in the table like loop back, off or on hook and secondary channels.
Loop Back– It is a method to perform transmission test of the lines at the switching center. Loop back allows user to test their own network to ensure it is functioning properly.
Off Hook– A condition that occurs when a telephone or other user instrument is in use that is during dialing or communicating. It was originally referred for telephones that have separate earpiece (receiver) which hangs on the switch hook until user wants to use it.
Secondary Channel –These are the data channels and have same capability as the first one. For example Secondary Transmitted Data (STD), Secondary Received Data (SRD), Secondary Request To Send (SRTS), Secondary Clear To Send (SCTS), and Secondary Carrier Detect (SDCD).
The table below shows the different signals and their functions
Fig. 8: Table Summarizing RS232 Pin-out Description
As we can see the standard provides abundance of control signals. There are only few applications that require all the defined signals otherwise only few signals are used like a typical modem uses only eight signals, some may require only four, two for data and two for handshaking and while others may use only data signals and no handshaking.
Handshaking & Conclusion
The handshaking in RS232 commonly known as “RTS/CTS” hand-shaking. The data terminal equipment asserts RTS pin to indicate a desire to transmit to DCE, and then DCE responds back through CTS pin to grant permission. Henceforth the modems disable their transmitters when not required and must transmit a synchronization signal to receiver when they are again re-enabled In latest version of RS232 E standard the handshaking is redefined where CTS (clear to send) is no longer a response to RTS but it indicates permission from DCE for the DTE devices. In the similar way RTS indicates permission from the DTE for the DCE to send data. RTS and CTS are controlled by DTE and DCE and independent of each other. A detailed handshaking system with eight signal lines is explained.
Fig. 9: Block Diagram Displaying Details of Handshaking System in RS232
When Data Carrier Detect is off it indicates to the local terminal that remote DTE has not switched on its RTS and local terminal can gain control over the line. When this circuit is on locally, it indicates to the local terminal that remote modem has received a RTS ON condition from its terminal and remote DTE is in control over the carrier line. RXD stand for receive data from modem to DTE. TXD transmits data from DTE to modem. The DTR data terminal ready pin is generally on when terminal is ready to establish communication channel through its modem. But when DTR does not want to accept calls from remote terminal the circuit is off. Both the modems switch on their Data Set Ready circuit on when communication path has been established between two sites. Now, when the terminal is ready to transmit it switches the Request to Send circuit on indicating local modem that it is ready to send data. This request gets passed on to remote modem. The RTS controls the direction of data transmission. Once terminal is ready to transmit local modem switches on the CTS circuit to indicate that it is ready to receive the data from DTE. It also gains control over the telephone line. Next when the modem receives the call , the Ring Indicator switches on/off informing DTE that a call is coming to indicate remote modem is requesting dial –up. This is a simple handshaking system with eight signal lines.
RS232 became the standard feature of a personal computer for connections to modems, printers, mouse, data storage and other peripheral devices. Though there are many new developments but RS232 still find its application. The first and foremost reason is the simplicity of the standard. It allows user to communicate directly with serial ports. There are fields like laboratory, automation, surveying who have sustained the demand for RS232 due to use of very expensive but aging equipments. It is far cheaper to use RS232 than replace the equipments. Not just the old equipments but modern automation devices such as servo drivers, CNC equipments etc. are programmable by RS232. Toshiba also re-introduced the DE-9M connector on the laptop. Serial ports with RS-232 are used to communicate to headless system such as a server where no keyboard is installed during boot. Some embedded systems use RS232 serial port to communicate as an alternative network mode monitoring.
Filed Under: Featured Contributions, Recent Articles