DB9 Pinout: RS-232 Pin Assignments and Null Modem Wiring

By editor Updated 8 min read
Front view of a DB9 connector with nine numbered pins, with transmit, receive and ground highlighted

A standard RS-232 DB9 pinout on a DTE port is: 1 DCD, 2 RXD, 3 TXD, 4 DTR, 5 GND, 6 DSR, 7 RTS, 8 CTS and 9 RI. For a basic serial link, you only need three of them: pin 2 (receive), pin 3 (transmit) and pin 5 (signal ground). If two DTE devices such as a PC and a PLC will not talk, the usual fix is a null modem cable that crosses pins 2 and 3.

PinSignalFull nameDTE directionDCE direction
1DCDData Carrier DetectInOut
2RXDReceived DataInOut
3TXDTransmitted DataOutIn
4DTRData Terminal ReadyOutIn
5GNDSignal GroundCommonCommon
6DSRData Set ReadyInOut
7RTSRequest to SendOutIn
8CTSClear to SendInOut
9RIRing IndicatorInOut
RS-232 DB9 pin assignments under TIA-574. Direction is shown from each device’s point of view.
Reader tip: Do not rely on connector gender to identify DTE or DCE. Male DTE and female DCE is only a convention, and many industrial devices break it.
9
Pins on the connector
3
Wires for a basic link
±3 V
Receiver threshold
2500 pF
Maximum load capacitance

DB9 Male and Female Pin Numbering

Pin numbers are molded into most connectors, but they are small and easy to misread. Viewed from the front of a male connector, the top row runs from 1 to 5 left to right, and the bottom row runs from 6 to 9. A female connector is the mirror image, so its top row reads 5 to 1 when you face it.

DB9 male and female pin numberingOn the front of a male DB9, the top row runs 1 to 5 from left to right and the bottom row 6 to 9. On the front of a female DB9, the numbering is mirrored.DB9 pin numbering, seen from the frontMale connector (pins)1DCD2RXD3TXD4DTR5GND6DSR7RTS8CTS9RIFemale connector (sockets)5GND4DTR3TXD2RXD1DCD9RI8CTS7RTS6DSRDataSignal groundHandshake and statusIndustrialBasicsindustrialbasics.com
Figure 1: The female face is a mirror image of the male face. Signal names shown are for a DTE port.
Wiring tip: Remember which side you are looking at. A connector seen from the solder side is mirrored compared with its front view, and that is one of the most common causes of a miswired serial cable.

What Each RS-232 Signal Does

SignalGroupWhat it does in practice
TXDDataCarries data out of the DTE
RXDDataCarries data into the DTE
GNDReferenceCommon reference for all signals
RTSFlow controlDTE asks permission to send
CTSFlow controlDCE confirms the DTE may send
DTRStatusDTE reports that it is ready
DSRStatusDCE reports that it is ready
DCDStatusDCE reports a carrier or active link
RIStatusModem signals an incoming call
RS-232 signals grouped by function.

Many modern devices ignore the handshake lines completely. Others will not transmit until they see CTS or DSR, so a correctly wired data pair can still appear dead. If a PLC or instrument has hardware flow control enabled, its handshake pins must be wired or the setting must be turned off.

DTE vs DCE: Why TX and RX Swap

RS-232 was designed to connect a DTE (Data Terminal Equipment, such as a computer) to a DCE (Data Communications Equipment, originally a modem). The DTE transmits on pin 3 and the DCE receives on pin 3, so a one-to-one cable works between them.

When two devices are both wired as DTE, both transmit on pin 3 and both listen on pin 2. Connected straight through, the two transmitters face each other and no data arrives. That is the problem a null modem cable solves.

Null Modem and Straight-Through Wiring

Straight-through and null modem DB9 wiringA straight-through cable connects each pin to the same pin. A full-handshake null modem crosses 2 and 3, 7 and 8, connects 4 to 6 and 1 at the other end, and keeps 5 to 5.Straight-through vs full-handshake null modemStraight-through (DTE to DCE)1 DCD1 DCD2 RXD2 RXD3 TXD3 TXD4 DTR4 DTR5 GND5 GND6 DSR6 DSR7 RTS7 RTS8 CTS8 CTS9 RI9 RINull modem (DTE to DTE)1 DCD1 DCD2 RXD2 RXD3 TXD3 TXD4 DTR4 DTR5 GND5 GND6 DSR6 DSR7 RTS7 RTS8 CTS8 CTS9 RI9 RIIndustrialBasicsindustrialbasics.com
Figure 2: A straight cable keeps pin numbers. A null modem crosses transmit and receive.

“Null modem” is not one fixed wiring. Several variants are sold under the same name, and they behave differently with devices that wait for handshake signals.

VariantDataGroundHandshake lines
Minimal (3-wire)2–3, 3–25–5Not connected
Loopback handshake2–3, 3–25–57 and 8 jumpered at each end; 1, 4 and 6 jumpered at each end
Full handshake2–3, 3–25–57–8, 8–7; 4 to 6 and 1 at the other end, in both directions
Common DB9 null modem variants. Check what your device expects.
Reader tip: If one “null modem” cable works and another does not, compare the handshake wiring. The data lines are probably the same in both.

RS-232 Voltage Levels

RS-232 does not use TTL or 3.3 V logic. A driver outputs +5 to +15 V or -5 to -15 V, while a receiver accepts anything from ±3 to ±15 V. The difference gives the signal a 2 V noise margin. The logic is inverted, so a negative voltage is a logic 1 (mark) and a positive voltage is a logic 0 (space).

RS-232 driver and receiver voltage levelsDrivers output plus or minus 5 to 15 volts. Receivers read plus 3 to 15 volts as logic 0 and minus 3 to 15 volts as logic 1. Between minus 3 and plus 3 volts the level is undefined.RS-232 voltage levelsDriver: +5 to +15 VDriver: -5 to -15 VReceiver: +3 to +15 V = logic 0 (space)Receiver: -3 to -15 V = logic 1 (mark)-3 V to +3 V: undefined+15 V+5 V+3 V0 V-3 V-5 V-15 VIndustrialBasicsindustrialbasics.com
Figure 3: RS-232 logic is inverted. A negative voltage is a logic 1.
Equipment warning: Never connect an RS-232 pin directly to a 3.3 V or 5 V microcontroller UART. The voltage can destroy the input. Use an RS-232 transceiver such as a MAX3232.

Cable length

Early versions of the standard quoted about 15 m (50 ft), but later revisions replaced that with a maximum load capacitance of 2500 pF. As a rough illustration, a cable of 50 pF per meter reaches that limit at 50 m, before device capacitance is counted. Lower baud rates are more tolerant, and a long or noisy run is often better served by RS-485. Choosing suitable shielded cable also helps in electrically noisy plants.

Not Every DB9 Port Is RS-232

This catches out many technicians in industrial panels. The same connector is used by fieldbuses that have completely different pinouts, and plugging in the wrong cable can stop the network or damage a port.

PinRS-232 (DTE)CAN (CiA 106)PROFIBUS DP
1DCDReservedShield (optional)
2RXDCAN_LM24 (optional)
3TXDCAN_GNDB (RxD/TxD-P)
4DTRReservedCNTR-P (optional)
5GNDCAN_SHLD (optional)DGND
6DSRGND (optional)VP (+5 V)
7RTSCAN_HP24 (optional)
8CTSReservedA (RxD/TxD-N)
9RICAN_V+ (optional)CNTR-N (optional)
The same connector can carry three very different interfaces.

RS-485 has no universal DB9 pinout, because its standard defines electrical levels and not a connector. PLC programming ports are often proprietary too, so always work from the manual for that model. For how these links fit into a plant network, see our comparison of PLC, DCS and SCADA.

How to Troubleshoot a DB9 Serial Link

  1. Confirm the interface. Check the manual to prove the port is RS-232 and not RS-485, CAN or a proprietary port.
  2. Match the settings. Baud rate, data bits, parity and stop bits must be the same at both ends.
  3. Do a loopback test. On the PC port, jumper pins 2 and 3 and type in a terminal program. If the characters echo, the port and software work.
  4. Measure idle TXD. With a meter between pin 3 and pin 5 on a DTE, an idle transmitter should read a negative voltage.
  5. Try a null modem. If both ends are DTE, cross pins 2 and 3.
  6. Check flow control. Turn off RTS/CTS and DTR/DSR, or wire them correctly.
  7. Inspect the ground and shield. Pin 5 must be connected, and the shield should follow the plant’s bonding practice.
SymptomLikely causeFix
No data in either directionTX and RX not crossedUse a null modem
Garbled charactersBaud or parity mismatchMatch the port settings
Data flows one way onlyBroken wire or flow controlCheck pins 2, 3 and handshake
Works, then stops after a whileFlow control or buffer issueCheck RTS/CTS and software settings
Errors when a motor runsElectrical noise or ground problemReroute the cable and review grounding
Common RS-232 faults and their fixes.

Noise problems often trace back to the installation, not the serial port. Our guides to earthing and grounding and power quality problems can help you find the source.

Choosing between serial standards? Our RS-232 vs RS-485 vs RS-422 guide compares distance, device count and noise immunity, and shows correct RS-485 wiring and termination.

Frequently Asked Questions

What is the pinout of a DB9 RS-232 connector?

On a DTE port: 1 DCD, 2 RXD, 3 TXD, 4 DTR, 5 GND, 6 DSR, 7 RTS, 8 CTS and 9 RI.

Which DB9 pins are TX and RX?

On a DTE such as a PC, pin 3 transmits and pin 2 receives. On a DCE the directions are reversed, so the DCE transmits on pin 2 and receives on pin 3.

Which pin is ground on a DB9 connector?

Pin 5 is signal ground on an RS-232 DB9 port. It is a reference for the signals and should not be used as a safety ground.

What is the minimum number of wires for RS-232?

Three wires are enough if hardware flow control is not used: transmit, receive and signal ground. A DTE-to-DTE link crosses 2 to 3 and 3 to 2, and connects 5 to 5.

What is the difference between a straight-through and a null modem cable?

A straight-through cable connects each pin to the same pin and is used from DTE to DCE. A null modem cable crosses transmit and receive so that two DTE devices can talk.

Is DB9 the correct name?

Strictly, the 9-pin D-subminiature connector is a DE-9, because its shell is size E. DB9 is the common name used by most people and product listings.

Is every DB9 port RS-232?

No. DB9 connectors are also used for CAN, PROFIBUS and vendor-specific RS-485 or RS-422 ports. Check the device manual before connecting anything.

How far can RS-232 run?

The standard limits load capacitance to 2500 pF instead of setting a fixed length. The usable distance depends on the cable capacitance and baud rate, so long runs at high speed need testing.

Sources and Further Reading

About the author

editor

Leave a Comment