RS/232 Pinouts & Cables

25 pin connector

Identifying the Pins

The first thing to know is how the pins in the connectors are numbers. To make life interesting, the numbering convention is chosen so that pin 1 on the "male" connector will connect to pin 1 and the "female" connector, and so on for all pins. This means that looking at a male connector, pin 1 is in the top left corner, while looking at a female connector pin 1 is in the top right corner. The diagram below illustrates:-

DB25 Pin Numbering

Happily, you don't need to actually remember this in any great detail. Most connectors have the pin numbers discreetly printed on them like the connector shown below:-

Pin numbers printed on connector

9 pin connector

Identifying the Pins

The pin numbering scheme is identical to that used for the 25 pin connector (see above). So pin 1 is in the top left corner of the "male" connector and the top right corner of the "female" connector.

Once again, the pin numbers are usually visible (if you squint !) on the connector casing:-

Pin numbers printed on connector

Cisco RJ45 Connector

More-or-less any Cisco device you buy now comes with a standard "console kit". This consists of an RJ45 "rollover" cable in a fetching shade of blue (it used to be black) and a selection of RJ45 to DB9 and DB25 adapters. The idea is that there are enough bits to allow you to connect anything (PC, terminal or modem) to the console or auxilliary port of your Cisco device by just picking out the correct connectors.

Cisco console cable is a "rollover"

Identifying the Pins

Unfortunately, this time you've got to learn them (or remember the URL for this page !) as they are not printed anywhere on the connector. Pins in RJ45 plugs and sockets are numbered as shown in the diagram:-

RJ45 plug/socket pin numbering

Connector Pinouts

DB25DB9Cisco RJ45Sun Console
Protective Ground1   
TX (Transmit)233?
RX (Receive)326?
RTS (Request To Send)471?
CTS (Clear To Send)588?
DSR (Data Set Ready)667?
DTR (Data Terminal Ready)2042?
DCD (Data Carrier Detect)81not present?
RI (Ringing Indicator)229not present?
GND (Signal Ground)754 & 5?

Terminal <-> Modem Connections

...or more precisely, DTE to DCE connections.

DB9 and DB25 Connectors

Connecting a DTE to a DCE (e.g. a PC to a modem) couldn't be any simpler. After all, that is exactly what the RS/232 specification is designed for. Quite simply, a "straight through" cable, linking pin 1 on the DTE connector to pin 1 on the DCE connector (etc.) is all that is required. Therefore, if you are using a DB25 connector, Pin 2 (TX) which is an output signal on a DTE (the PC) is linked to Pin 2 on the DCE the modem (where it is also called TX, but is an input signal).

Minimal Null Modem

Cisco Console Kit

The Cisco console kit is an interesting and clever animal. TODO: why ?!

Terminal <-> Terminal Connections

Connecting a DTE to a DTE raises some interesting questions. Several of the RS/232 signals (Data Carrrier Detect, for example) are quite modem-specific and don't make much sense when connecting two DTE devices (e.g. two PCs) directly to each other with no DCE (modem) devices in the middle.

In order to make this work properly, a specially wired cable called a Null Modem is required. This is simply two DTE connectors wired to "fake" the missing modem signals in some meaningful way. There are a few variations on the design, depending on whether or not you are using hardware flow control and what the operating system expects to see on the interface control lines. Regardless of which variation, the objectives are:-

The "minimal" Null Modem

Minimal Null Modem

Here, we simply connect Tx on each side to Rx on the other, and connect the GND pins together. DSR and DCD on each side are served by connecting them both to the local DTR. Therefore, when DTR is activated (because you've just started your favourite terminal emulator), immediately and by magic DSR and DCD become active. TODO: something about RTS/CTS here

The only problem, ofcourse, is that there is no provision for hardware flow control. In this case, a software flow control mechanism (such as XON/XOFF will be necessary to avoid buffer overruns in the receiver.

Null Modem with RTS/CTS Flow Control

Null Modem with RTS/CTS Flow Control

This is a slightly more sophisticated version of the Null Modem. DSR and DCD are still looped to the local DTR signal, but RTS on each side is connected to CTS on the other. This allows for RTS/CTS based hardware flow control, which is the normal hardware flow control mechanism.

There is still no way for either side to detect that the transmitter on the other side is long as the local DTR is active, the local DSR and DCD signals will be "faked" back

Full Null Modem

Full Null Modem

The Rolls Royce of null modems ! Here, we use DTR from each side to signal DSR and DCD of the other side. So, when you shut down your favourite terminal emulator (which hopefully isn't the hideously awful Hyperterminal !) the device you are connected to will see DCD and DSR drop. Many devices will do nothing. Others (including many UNIX hosts) will automatically shut down any active session.

Cisco Console Kit

You can almost get a full Null Modem using a Cisco console cable and two of the "Terminal" connectors (e.g. any combination of DB9s and "female" DB25s). This is thanks to the ingenuity of the RJ45 connector pinout and the use of the "rollover" cable. The diagram below illustrates:-

Full Null Modem
(please do not adjust your set! The connector on the right is shown inverted to highlight the fact that the connecting cable is a "rollover")

The only difficulty is that DCD is not included. Depending on what you are using the cable for, this may not be a problem (e.g. if the operating system or communications software on both sides ignore DCD). For many applications, however it is a fatal flaw. For example, it is because of this that the Cisco Null Modem cannot be used to connect a PC to a UNIX console port on some UNIX machines. Modifying the "Terminal" (DTE) connector to connect DTR to DCD internally gets around this problem without affecting anything else. I carry such a modified connector with me now to be prepared for just such an emergency (!) and it works just fine.

Null Modem Pinout Generator

If you had known this was here, you wouldn't have had to read all the stuff above :-)

Use this tool to figure out the pinout you need to make a full null modem between any pair of DTE connectors.

Connector A
Connector B
Protective Ground
Transmit -» Receive
Receive -» Transmit
Signal Ground

I will add other connectors to the list as people request (or better yet, contribute !) them.

Back to