Serial Communications Support



RS-232 & EIA-232: Connectors and Cabling

Most serial ports follow a standard called the RS-232, also known as the EIA-232 specification. RS-232 is an advanced plan-for-all needs specification. Being that it is from origins in the 60's, it is neither simple nor perfect in every situation for every computer or peripheral. In fact, it is well beyond what is required for most standard communication. However, it does work. Though it has been difficult because of design complexity and a lack of thorough understanding, it is good enough to have become an industry standard, or as the RS indicates, a Recommended Standard.

DB-25 Table
DB-25 pin configuration
Pin Name EIA Signal
1 FG Frame ground
2 TD Transmitted data
3 RD Received data
4 RTS Request to send
5 CTS Clear to send
6 DSR Data set ready
7 SG Signal ground
8 DCD Data carrier signal
9 None Positive voltage - Test Conditions
10 None Negative voltage - Test Conditions
11 None Unassigned - Test Conditions
12 SDCD Secondary DCD
13 SCTS Secondary CTS
14 STD Secondary TD
15 TC Transmit clock
16 SRD Secondary RD
17 RC Receive clock
18 none Unassigned - Test Conditions
19 SRTS Secondary RTS
20 DTR Data terminal ready
21 SQ Signal quality detector
22 RI Ring indicator
23 DRS Data rate selector
24 SCTE Clock transmit external
25 BUSY Busy

RS-232 defines the meaning of the different serial signals and their respective pin assignments on a standard 25-pin (DB-25) serial connector. The DB-25 Table shows these assignments. Under most conditions in the real world and in standard types of communications only 9 of these pins are important: 1-8, and 20.

DB-25 connectors are either male, with the pins sticking out, or female, with matching holes. Often there are very small numbers marking the pins or holes 1-25. The female connector is a mirror image of the male so that pins and holes match.

Originally, there was no standardization of the gender of connectors and serial devices. Both connectors and serial devices could be either gender. However, since male connectors are more susceptible to injury than female, most expensive computing hardware these days has female connectors, while cables are male on both ends.

Since RS-232 defines signals that are not used for most standard communication, sometimes DB-25 connectors are missing unneeded pins. In this case, serial cables simply leave the unused pins disconnected.

Cabling

There are two cable configurations in use today for serial equipment:

DTE (Data Terminal Equipment)
Generally used for computers, terminals, and printers.

DCE (Data Communications Equipment)
Generally used for modems and devices that act as modems.

These different configurations determine which signal a device anticipates on which pin. All devices are configured as either DTE or DCE. Because terminals are typically DTE, and modems are generally DCE, a different cable between a computer and a terminal must be used as opposed to a cable used between a computer and a modem.

The RS-232 specification defines the the maximum length of serial cable to be 75 feet at 9,600 bps. This is a pretty conservative figure and has been stretched as far as several thousand feet, especially at this baud rate. With current modem baud rates limited only by the communications guidleline of just under 56 kbs, direct serial communications now are capable in certain cases of 512 kbs. How far the limit can be stretched depends on the brand of terminal and computer you are using. This is something to keep in mind when connecting terminals (and computers simulating terminals) to computers in distant or remote locations.

Alternate Serial Connectors

Because of the fact that RS-232 defines signals that go unused in standard types of communication, and because the traditional DB-25 connector is cumbersome (especially for small equipment, such as laptops), many alternate serial connectors have come into widespread use. These connectors provide the same necessary pins as a DB-25, but are smaller, more manageable connectors. Because they provide access to the same signals, devices that use different connectors are compatible as long as you use the right kind of converter cable. The popularity of DIN-8 is not high compared to the DB-25 and DB-9, therefore ready made cables are not easily found. There are converters that allow use of standard cables.

DIN-8

DIN-8 serial connectors are small, and nearly circular in pin placement. They have a key so that they can only be connected one way. They look like the original keyboard connectors for PCs, though those were DIN-5 connectors. They are used on Macs, and on some laptops because they are so compact. DIN-8s provide the seven most common serial signals whose pin assignments are shown in the DIN-8 Table.

DIN-8 Table
DIN-8 pin configuration
DIN-8 Pin Corresponding DB-25 Pin EIA Signal Function
3 2 TD Transmitted data
5 3 RD Received data
6 4 RTS Request to send
2 5 CTS Clear to send
4,8 7 SG Signal ground
7 8 DCD Data carrier detect
1 20 DTR Data terminal ready

DB-9

DB-9s are most commonly found on modern PCs and laptops. Many computers had both a DB-25 and a DB-9, designated as COM1 and COM2. Modern equipment still uses at least one DB-9, along with one or more USB ports. They look like smaller versions of the DB-25 connector. DB-9s provide the eight most common serial signals whose pin assignments are shown in the DB-9 Table.

DB-9 Table
DB-9 pin configuration
DB-9 Pin Corresponding DB-25 Pin EIA Signal Function
2 3 RD Received data
3 2 TD Transmitted data
8 5 CTS Clear to send
7 4 RTS Request to send
6 6 DSR Data set ready
5 7 SG Signal ground
4 20 DTR Data terminal ready
1 8 DCD Data carrier detect

RJ-45

RJ-45 connectors look a lot like standard telephone connectors, however, they are not. They house eight wires, sometimes solid and sometimes stranded, instead of the normal four wires in a telephone connector, designated as an RJ-11. RJ-45s are not typically found on computers or normal serial equipment, but, because they are so small, they are often used on devices that have a lot of ports very close together. RJ-45s are also used for 10-Base-T and 100-Base-T network connections. Terminal servers, multiplexors and data port switches are a good example of devices that often use RJ-45 connectors.

There are many wiring schemes for mapping the pins on an RJ-45 connector to a DB-25 connector. Possibly the best is the Yost standard, which wires all RJ-45 to DB-25 connections the same way. The advantages this system provides are:

  • All cable connections are of the same gender.
  • There is no distinction between DTE and DCE.
  • Because of the above, you can use the same kind of cable everywhere.

For more information about the Yost wiring standard see the optional document, Yost Serial Device Wiring Standard.

Hard Vs. Soft Carrier

When a serial device is attached to the system and turned on, Unix, Xenix, Linux, and most other operating systems with roots and foundations in the 60s and 70s, expect the DCD signal (data carrier detect) to be asserted. If your system pays close attention to whether that signal is asserted, you are using what is called hard carrier. Most current operating systems also allow the use of soft carrier where the system pretends that the DCD signal is always asserted.

Soft carrier is often a very good thing for certain devices. For instance, with a terminal, it lets you use only 3 wires for a connection: transmitted data, received data, and signal ground, pins 2, 3 and 7 on a DB-25. However, in a modem connection, you really want to pay valid attention to DCD. When you are connected via a modem, if the carrier signal is lost, you want the modem to hang up. If you are using soft carrier, DCD is assumed to be asserted, perhaps as in this case, an invalid assumption. Even if you lose the signal, the modem can remain connected. This can be a potentially devastating problem over a long distance connection since the modem could potentially remain connected for days.

Most modern systems set a default carrier mode for serial ports in their configuration files. The command stty -CLOCAL will force a terminal to use soft carrier, so for instance:

        stty -CLOCAL < /dev/ttya

would enable soft carrier on serial port ttya.


International Copyright Violation
Registered® Trademark™ and Copyright© 1973 - CSG, Computer Support Group, Inc. and CSGNetwork.Com All Rights Reserved