PAA Home Page   laboratory automation  
21 CFR Part 11  
  process acoustics  
     
 
 
Serial communications & cables
     
Introduction Introduction
  RS232 serial cable layout

Almost nothing in computer interfacing is more confusing than selecting the right RS232 serial cable. These pages are intended to provide information about the most common serial RS232 cables in normal computer use, or in more common language "How do I connect devices and computers using RS232?"

This section offers a full guide to serial connectors:

     
RS232 serial connector pin assignment RS232 serial connector pin assignment
 

The RS232 connector was originally developed to use 25 pins. In this DB25 connector pinout provisions were made for a secondary serial RS232 communication channel. In practice, only one serial communication channel with accompanying handshaking is present. Only very few computers have been manufactured where both serial RS232 channels are implemented. Examples of this are the Sun SparcStation 10 and 20 models and the Dec Alpha Multia. Also on a number of Telebit modem models the secondary channel is present. It can be used to query the modem status while the modem is on-line and busy communicating. On personal computers, the smaller DB9 version is more commonly used today. The diagrams show the signals common to both connector types in black. The defined pins only present on the larger connector are shown in red. Note, that the protective ground is assigned to a pin at the large connector where the connector outside is used for that purpose with the DB9 connector version.

The pinout is also shown for the DEC modified modular jack. This type of connector has been used on systems built by Digital Equipment Corporation; in the early days one of the leaders in the mainframe world. Although this serial interface is differential (the receive and transmit have their own floating ground level which is not the case with regular RS232) it is possible to connect RS232 compatible devices with this interface because the voltage levels of the bit streams are in the same range. Where the definition of RS232 focused on the connection of DTE, data terminal equipment (computers, printers, etc.) with DCE, data communication equipment (modems), MMJ was primarily defined for the connection of two DTE's directly.

RS232 DB9 pinout

RS232 DB9 pin assignment

RS232 DB25 pinout

RS232 DB25 pin assigment

     
RS232 DB9 to DB25 converter RS232 DB9 to DB25 converter
 

The original pinout for RS232 was developed for a 25 pins sub D connector. Since the introduction of the smaller serial port on the IBM-AT, 9 pins RS232 connectors are commonly used. In mixed applications, a 9 to 25 pins converter can be used to connect connectors of different sizes. As most of the computers are equipped with the DB9 serial port version, all wiring examples on this website will use that connector as a default. If you want to use the example with a DB25, simply replace the pin numbers of the connector according to the conversion table below.

RS232 DB9 to DB25 converter

RS232 DB9 to DB25 converter

DB9 - DB25 conversion

DB9

DB25

Function

1

8

Data carrier detect

2

3

Receive data

3

2

Transmit data

4

20

Data terminal ready

5

7

Signal ground

6

6

Data set ready

7

4

Request to send

8

5

Clear to send

9

22

Ring indicator

     
RS232 serial loopback test plugs RS232 serial loopback test plugs
 

The following RS232 connectors can be used to test a serial port on your computer. The data and handshake lines have been linked. In this way all data will be sent back immediately. The PC controls its own handshaking. The first test plug can be used to check the function of the RS232 serial port with standard terminal software. The second version can be used to test the full functionality of the RS232 serial port with Norton Diagnostics or CheckIt.

RS232 loopback test plug for terminal emulation software

RS232 DB9 loopback connector

RS232 DB25 loopback connector

DB9

DB25

Function

1 + 4 + 6

6 + 8 + 20

DTR

CD + DSR

2 + 3

2 + 3

Tx

Rx

7 + 8

4 + 5

RTS

CTS

RS232 loopback test plug for Norton Diagnostics and CheckIt

RS232 DB9 loopback connector (Norton/CheckIt)

RS232 DB25 loopback connector (Norton/Checkit)

DB9

DB25

Function

1 + 4 + 6 + 9

6 + 8 + 20 + 22

DTR

CD + DSR + RI

2 + 3

2 + 3

Tx

Rx

7 + 8

4 + 5

RTS

CTS

Testing occurs in a few steps. Data is sent on the Tx line and the received information on the Rx input is then compared with the original data. The signal level on the DTR and RTS lines is also controlled by the test software and the attached inputs are read back in the software to see if these signal levels are properly returned. The second RS232 test plug has the advantage that the ring-indicator RI input line can also be tested. This input is used by modems to signal an incoming call to the attach

   
RS232 null modem cables RS232 null modem cables
 

The easiest way to connect two PC's is using an RS232 null modem cable. The only problem is the large variety of RS232 null modem cables available. For simple connections, a three line RS232 cable connecting the signal ground and receive and transmit lines is sufficient. Depending of the software used, some sort of handshaking may however be necessary..

RS232 null modem cables with handshaking can be defined in numerous ways, with loopback handshaking to each PC, or complete handshaking between the two systems. The most common null modem cable types are shown here.

Simple RS232 null modem without handshaking

Simple RS232 null modem without handshaking

Connector 1

Connector 2

Function

2

3

Rx

Tx

3

2

Tx

Rx

5

5

Signal ground

RS232 null modem with loop back handshaking

RS232 null modem with loop back handshaking

Connector 1

Connector 2

Function

2

3

Rx

Tx

3

2

Tx

Rx

5

5

Signal ground

1 + 4 + 6

-

DTR

CD + DSR

-

1 + 4 + 6

DTR

CD + DSR

7 + 8

-

RTS

CTS

-

7 + 8

RTS

CTS

RS232 null modem with partial handshaking

RS232 null modem with partial handshaking

Connector 1

Connector 2

Function

1

7 + 8

RTS2

CTS2 + CD1

2

3

Rx

Tx

3

2

Tx

Rx

4

6

DTR

DSR

5

5

Signal ground

6

4

DSR

DTR

7 + 8

1

RTS1

CTS1 + CD2

RS232 null modem with full handshaking

RS232 null modem with full handshaking

Connector 1

Connector 2

Function

2

3

Rx

Tx

3

2

Tx

Rx

4

6

DTR

DSR

5

5

Signal ground

6

4

DSR

DTR

7

8

RTS

CTS

8

7

CTS

RTS

   
Spy / monitor cable Spy / monitor cable
  Introduction on monitoring serial RS232 data

The RS232 standard defines an asynchronous way of communication between DTE, data terminal equipment (computers, printers, etc.) and DCE, data communication equipment (modems). This type of communication has become the minority and nowadays serial communications is mainly between two DTE devices using a null modem cable. Although this is 1:1 communication, it is possible with special cables to monitor the data streams.

RS232 provides 2 data lines for each data channel. One is for transmitting data and the other for receiving. Because of these two separate lines, data can be send full duplex. This means that both ends can send and receive data simultaneously without mutual interference. In most situations however the high level communication protocol only allows half duplex communications because most simple protocols with external devices work with a master-slave, or question-answer configuration. One of the parties is the master which is in charge of communications. This master sends commands and requests to the slave which responds to them. The slave will never by itself start a communication sequence so in practise the communication is half duplex: There is no single moment when both sides send data simultaneously.

That most RS232 communication is performed in a half duplex way is important if the data stream has to be monitored. A half duplex communication protocol can be spied with a computer with just one serial port attached. This port listens to both RS232 communication lines simultaneously but no data will be garbled because only one party sends at a time. This type of communication can be spied with simple software like the terminal emulation program HyperTerminal which is shipped with the Windows operating system.

In the situation of full duplex communication on a RS232 channel we cannot simply tie both lines together and listen to it. For this situation you need two separate serial ports on the espionage computer. Also special sniffer software is handy that listens to both ports simultaneously and outputs the data of both lines to the screen or to disk.

Half duplex RS232 spy / monitor / sniffer cable

It is not difficult to monitor half duplex RS232 serial communication between two devices with a PC. To do this you need the RS232 monitor cable which is displayed in the next picture. Two DB9 connectors are wired straight through. The spy computer is connected to the third connector. This monitor cable taps communication from two sources on only one RS232 receiver port. This means that if the two devices happen to talk simultaneously, the monitored information will be garbage. In most circumstances communication protocols work half duplex, in which case this RS232 cable will work without problems. Otherwise you need the full duplex RS232 monitor cable which is discussed here also.

Half duplex RS232 spy / monitor / sniffer cable

Half duplex RS232 spy / monitor / sniffer cable

Connector 1

Connector 2

Spy

Function

1

1

-

Carrier detect

2

2

2 via R1

Rx

Rxspy

3

3

2 via D1

Tx

Rxspy

4

4

-

Data terminal ready

5

5

5

Signal ground

6

6

-

Data set ready

7

7

-

Request to send

8

8

-

Clear to send

9

9

-

Ring indicator

-

-

1 + 4 + 6

DTR

CD + DSR

-

-

7 + 8

RTS

CTS

The electronic diagram looks simple and strange at the same time with one diode and one resistor. The functionality is however straight forward. The spy computer is attached to the connector in the right bottom. The female connector at the left is attached to the spied computer and the male connector at the right to the attached device.

When an RS232 port is in an idle state, it will be in the so-called marking state with a negative voltage at the transmit output. Assume the computer connected to the left port is sending data and the peripheral device at the right side is idle. At that moment the RS232 signal level on line 3 will change. When the voltage of this line changes to a higher value, current will flow through the diode to the spy computer. We assume the attached device is in an idle state. Therefore, the voltage at line 2 is something like -12 Volt, while at the other end of the resistor +12 Volt is applied. Simple mathematics learns that a current of approximately 11 mA (=24 Volt/2200 Ohm) flows through the resistor. This is no problem because most RS232 driver IC's are capable to deliver at least 45 mA. Because the voltage drop over the diode is only 0.7 Volt—independent of the current through the diode—the spy computer will see on its RS232 port (almost) the same voltage levels as present on the transmit port of the sending computer and data from the sending computer to the peripheral device is successfully captured.

In the second situation the computer has finished sending data and waits for an answer from the device at the male connector. The RS232 signal level at line 2 will go to positive values. The diode will block current to line 3 so the spy computer effectively only sees the data coming from the peripheral device. Now the spy computer will be able to pick-up the data send from the device back to the computer.

In the diagram for the half duplex monitor cable some shorts have been made between pins of the connector of the spying computer. These shorts loopback the handshaking signals of the computer. In most cases these shorts won't be necessary, but if the spy monitoring software uses handshaking, this will prevent the monitor software from blocking.

You don't need expensive software to use this RS232 spy cable. A simple serial terminal emulator like the HyperTerminal program present on all Windows based computers is enough to spy your communications. The only thing you need to do is changing the baud rate and start and stop bits settings from the terminal emulation program to the settings used on the line to monitor.

Full duplex RS232 spy / monitor / sniffer cable

As already discussed, it is not possible to monitor a full duplex RS232 communication with only one spy port. For this purpose the full duplex monitor cable can be used. This cable connects to two serial ports on the spy computer where each ports taps one direction of the communication. You could open two sessions of a terminal emulation program on your computer, but often better is to use one of the specialized RS232 monitor software products. In that way the two communication streams are merged in one screen which makes it easier to analyze the sequence of the communications.

Full duplex RS232 spy / monitor / sniffer cable

Full duplex RS232 spy / monitor / sniffer cable

Connector 1

Connector 2

Spy port 1

Spy port 2

Description

1

1

-

-

Carrier detect

2

2

2

-

Rx

Rx1

3

3

-

2

Tx

Rx2

4

4

-

-

Data terminal ready

5

5

5

5

Signal ground

6

6

-

-

Data set ready

7

7

-

-

Request to send

8

8

-

-

Clear to send

9

9

-

-

Ring indicator

-

-

1 + 4 + 6

-

DTR

CD + DSR

-

-

7 + 8

-

RTS

CTS

-

-

-

1 + 4 + 6

DTR

CD + DSR

-

-

-

7 + 8

RTS

CTS

The diagram of the full duplex RS232 monitor cable is actually simpler than the diagram of the half duplex monitor cable. This is because no special circuitry is necessary to combine two communication lines on one input. Just to be sure, all handshake signals on both spy connectors have been looped back. This prevents the software from blocking input in case it checks the CTS, DSR or CD inputs.

Software for RS232 logging

A spy cable is not the only requirement to monitor incoming and outgoing RS232 communications. You will also need software which can log the incoming data and store it. This software should—in case of full duplex communication—be able to log at least two channels concurrently.

A good software package for monitoring is Comm-logger from Willies Computer Software Co. This software can log up-to 32 channels concurrently and will be sufficient for most monitor and log purposes. It works under all 32 bits Windows versions. The settings are controlled with an intuitive graphical interface. For silent logging in the background there is also a command line option available.

   
Serial printer cables Serial printer cables
    Introduction to RS232 serial printer cables

The RS232 standard describes the communication between DTE, data terminal equipment (computers, printers, etc.) and DCE, data communication equipment (modems). For those situations where two DTE devices must be connected directly, null modem cables can be used. However, for some types of communications standard symmetrical null modem cables are not the appropriate solution. One of these situations is the connection of a serial printer with a computer. Although the serial connection is two-way, data is only sent from the computer to the printer. It wouldn't surprise me if most serial printers work without problems if the Tx line of the printer is not connected to the Rx of the computer at all.

The main problem of this asymmetric use of RS232 communications is that the handshaking is also not symmetric. There is no need for the computer to send handshaking signals to the printer. The printer however has many situations which need handshaking to stop the computer for sending data. Think of out of paper, off line or form feed situations. Also older serial connected printers often use a mechanical printing method like dot matrix or daisywheel which speed is limited by the mechanical construction. Besides this some printer manufactures decided to use pins not normally used on RS232 interfaces to make the situation even more confusing.

The wiring diagrams on this page won't fit to all situations, but you will get your printer connected in at least 95% of the cases. Alternatively you might try one of the null modem cables. There are cases where disabling all hardware flow control and switching to a simple null modem cable with XON/XOFF handshaking is the only method to successfully connect a serial printer to a computer.

Common serial printer cable

When a serial printer is connected to a PC with an RS232 cable, the handshaking is not symmetrical any more. In that case an RS232 cable is used where some handshaking lines at the PC side are looped back. On the printer side only the data lines and one handshaking line are used. The printer doesn't send large amounts of data to the attached computer, so there is no need to use handshaking lines on the printer to control the data flow. The only RS232 signal used in this cable is the DTR signal which is used by the printer to inform the computer about error situations like out of paper etc. This cable should work with most serial printers.

General RS232 serial printer cable

General RS232 printer cable

Computer

Printer

Function

2

2

Rx

Tx

3

3

Tx

Rx

5

7

Signal ground

1 + 4

-

DTR

CD

6 + 8

20

DSR + CTS

DTR

Fujitsu serial printer cable

Fujitsu recommends a different cable wiring diagram to connect printers from this manufacturer to computers. In this situation the DTR of the printer is send back to the DSR input of the computer. The other handshaking signals RTS and CTS are looped back on both sides.

Fujitsu serial printer cable

Fujitsu serial printer cable

Computer

Printer

Description

2

2

Rx

Tx

3

3

Tx

Rx

5

7

Signal ground

6

20

DSR

DTR

7 + 8

-

RTS

CTS

-

4 + 5

RTS

CTS

Texas Instruments 800 and OKI Data MicroLine 80 and 90 printer cable

Really strange is the serial printer cable wiring diagram for the Texas Instruments 800 and OKIData MicroLine 80 and 90 series printers. These printers use the SRTS, secondary request to send line at pin 11 to connect to the CTS of the computer. Pin 11 is unused on almost all serial ports so it will be difficult to find the right cable at your computer store. The diagram can be helpful to modify or build your own cable to connect these printers to your computer.

TI 800 and OKIData ML 80 and 90 serial printer cable

TI 800 and OKIData ML 80 and 90 serial printer cable

Computer

Printer

Function

2

2

Rx

Tx

3

3

Tx

Rx

5

7

Signal ground

6

6 + 20

DSR1 + DSR2

DTR

8

11

CTS

SRTS

     
Yost RS232 on RJ45 standard Yost RS232 on RJ45 standard
   

Introduction in the Yost wiring standard

The wiring of RS232 has always been a problem. Originally the standard was defined for DTE, data terminal equipment to DCE, data communication equipment connection, but soon people started to use the communication interface to connect two DTEs directly using null modem cables. No standard was defined for null modem connections with RS232 and not long after their introduction, several different wiring schemes became common.

UTP and FTP cables with RJ45 connectors became the de-facto standard in office cabling systems, and people started looking for ways to transmit RS232 signals over this cabling system. The RS-232D standard (more properly called EIA/TIA 561) was the official attempt for a standard to transmit RS232 over RJ45. Unfortunately this attempt didn't twist the cable internally. Therefore it primarily remained a standard for DTE to DCE connection in a world where the primary use of RS232 was to interconnect DTEs directly.

Very interesting is the RS232 to RJ45 wiring standard proposed by Dave Yost in 1987, based on earlier wiring schemes used at Berkeley University. He tried to define a standard comparable to DECConnect, where both DTEs and DCEs could be connected with one cable type. This standard was published in the Unix System Administration Handbook in 1994, and has since that moment been a wiring standard for many organisations. We will discuss this standard in detail here.

Goals of the Yost device wiring standard

The mess with RS232 wiring is widely known. It was the reason for starting this website. Dave Yost wanted to solve that mess once and for all, reaching as much as possible of the following goals:

  1. All cable connectors should have the same connector type (RJ45)
  2. All cable connectors should have the same connector gender (male)
  3. DTEs and DCEs should have the same connector wiring
  4. All cables should be identical (except for length)
  5. No need for null modems or other special cables for specific situations

These goals are very close to the goals DEC wanted to achieve with DECConnect. The Yost standard has however one basic advantage. Because RJ45 connectors are used, eight pins are available which makes it possible to transfer almost all RS232 signals. Therefore the Yost standard can be used with much more equipment than DECConnect.

The Yost cable

One cable for all solutions is the basis of the Yost standard. This cable is not a straight through patch cable with two RJ45 connectors crimped to each end, but a cross-cable where pin 1 is connected to pin 8, pin 2 to 7 etc. The basic layout of this cable is shown below. In this picture flat cable is used, which is specially designed for use with RJ45 connectors. Do not use cross cables that are sold in some computer stores. Those cables cross some pairs to make the connection of two computers with ethernet network cards possible without a hub, but these cables are not recommended for Yost systems.

Basic Yost cable with two RJ45 connectors cross connected

Basic Yost cable with two RJ45 connectors cross connected

RJ45 plug 1

RJ45 plug 2

Function

1

8

CTS

RTS

2

7

CD

DTR

3

6

Rx

Tx

4

5

Signal ground

5

4

Signal ground

6

3

Tx

Rx

7

2

DTR

CD

8

1

RTS

CTS

I have used the DTE signal names here, just as is common with the DECConnect interface. DTE is the rule, DCE is the exception in that approach. The signal ground has been split in two lines to get a symmetric layout. Two common RS232 signals are missing on the RJ45 connector. The ring indicator RI is often not necessary because most modems also signal incoming rings with the text "RING" on the data lines. Data set ready DSR is not implemented because it can easily be emulated by connecting the DTR and DSR lines in the adapter at the DTE side.

If twisted pair cable is used with the RJ45 connectors, the following pairs are advised to minimize cross-talk between the lines: 1-2, 3-4, 5-6 and 7-8. When twisting this way, both data lines are twisted with their own signal ground line, adding some noise immunity. Twisting of the handshake lines is less critical. The exact color-scheme to connect the twisted pair cable to the RJ45 connectors is not important for the functionality of the cable, but it is important for yourself to use only one color-scheme to prevent errors. If you don't know which color-scheme to use, I advice the following which is a modified version of the EIA/TIA-568B color coding.

Yost cable with twisted pair wiring
Yost cable wiring

Yost DTE adapter wiring

Now we know how the cables are wired, it is time to define the adapter wiring for various equipment. Depending of the type of equipment, DB9 or DB25 connectors are used. Layouts for both connectors to a RJ45 socket for DTE equipment is shown here. The colors are defined by the Yost standard. The DTR to DSR connection is optional. Please use the manual of the device or software to decide if this loop is necessary. It doesn't harm most of the time if you connect both lines, even with systems that don't use the DSR input signal.

Yost DB9 to RJ45 serial DTE adapter wiring

Yost DB9 to RJ45 serial DTE adapter wiring

Yost DB25 to RJ45 serial DTE adapter wiring

Yost DB25 to RJ45 serial DTE adapter wiring

RJ45

Function

Color

DB9

DB25

1

CTS

Blue

8

5

2

CD

Orange

1

8

3

Rx

Black

2

3

4

SG

Red

5

7

5

SG

Green

5

7

6

Tx

Yellow

3

2

7
 

DTR
DSR

Brown
 

4
6

20
6

 


optional

8

RTS

White

7

4

A special note about printers

In the Yost standard, Dave Yost defines printers as DCE devices which is IMHO not correct. From an historical point of view, printers are just the predecessors of the terminal, with the teletype as intermediate. Also, the serial RS232 wiring diagrams I know for printers all use a modified null modem version for the connection to a computer, rather than a straight through connection which would be the case when the printer was wired as DCE.

But although the definition of printers as DCE might not be correct, the notes in the Yost standard about special precautions with the handshaking signals still apply. As there is no standard for wiring the handshaking signals of serial printers, my advice is to look at my serial printer page or—if available—in the technical manual of your device to find out which RS232 handshaking signals are used. Then wire the adapter accordingly.

Yost DCE adapter wiring

The wiring of a Yost RS232 to RJ45 adapter for a DCE is more or less a mirror of the DTE adapter wiring. The Yost standard defines the wiring scheme for both DB9 and DB25 connectors. Because DB9 connectors are rarely used on DCEs, there is only a picture of the larger version here. The table lists the pinouts for DB9 when needed in a specific situation.

Yost RJ45 to DB25 serial DCE adapter wiring

Yost RJ45 to DB25 serial DCE adapter wiring

RJ45

Function

Color

DB9

DB25

1

RTS

Blue

7

4

2

DTR

Orange

4

20

3

Tx

Black

3

2

4

SG

Red

5

7

5

SG

Green

5

7

6

Rx

Yellow

2

3

7

CD

Brown

1

8

8

CTS

White

8

5

   
More Information Contact Information
 

If you require any more information or have any questions about these products, please contact us:

 
Copyright 2004-2008 paa | XHTML | CSS
All manufacturers' trademarks are gratefully acknowledged. paa is the trademark of Process Analysis & Automation Ltd.