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.
| Pin | Signal | Full name | DTE direction | DCE direction |
|---|---|---|---|---|
| 1 | DCD | Data Carrier Detect | In | Out |
| 2 | RXD | Received Data | In | Out |
| 3 | TXD | Transmitted Data | Out | In |
| 4 | DTR | Data Terminal Ready | Out | In |
| 5 | GND | Signal Ground | Common | Common |
| 6 | DSR | Data Set Ready | In | Out |
| 7 | RTS | Request to Send | Out | In |
| 8 | CTS | Clear to Send | In | Out |
| 9 | RI | Ring Indicator | In | Out |
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.
What Each RS-232 Signal Does
| Signal | Group | What it does in practice |
|---|---|---|
| TXD | Data | Carries data out of the DTE |
| RXD | Data | Carries data into the DTE |
| GND | Reference | Common reference for all signals |
| RTS | Flow control | DTE asks permission to send |
| CTS | Flow control | DCE confirms the DTE may send |
| DTR | Status | DTE reports that it is ready |
| DSR | Status | DCE reports that it is ready |
| DCD | Status | DCE reports a carrier or active link |
| RI | Status | Modem signals an incoming call |
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
“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.
| Variant | Data | Ground | Handshake lines |
|---|---|---|---|
| Minimal (3-wire) | 2–3, 3–2 | 5–5 | Not connected |
| Loopback handshake | 2–3, 3–2 | 5–5 | 7 and 8 jumpered at each end; 1, 4 and 6 jumpered at each end |
| Full handshake | 2–3, 3–2 | 5–5 | 7–8, 8–7; 4 to 6 and 1 at the other end, in both directions |
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).
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.
| Pin | RS-232 (DTE) | CAN (CiA 106) | PROFIBUS DP |
|---|---|---|---|
| 1 | DCD | Reserved | Shield (optional) |
| 2 | RXD | CAN_L | M24 (optional) |
| 3 | TXD | CAN_GND | B (RxD/TxD-P) |
| 4 | DTR | Reserved | CNTR-P (optional) |
| 5 | GND | CAN_SHLD (optional) | DGND |
| 6 | DSR | GND (optional) | VP (+5 V) |
| 7 | RTS | CAN_H | P24 (optional) |
| 8 | CTS | Reserved | A (RxD/TxD-N) |
| 9 | RI | CAN_V+ (optional) | CNTR-N (optional) |
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
- Confirm the interface. Check the manual to prove the port is RS-232 and not RS-485, CAN or a proprietary port.
- Match the settings. Baud rate, data bits, parity and stop bits must be the same at both ends.
- 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.
- Measure idle TXD. With a meter between pin 3 and pin 5 on a DTE, an idle transmitter should read a negative voltage.
- Try a null modem. If both ends are DTE, cross pins 2 and 3.
- Check flow control. Turn off RTS/CTS and DTR/DSR, or wire them correctly.
- Inspect the ground and shield. Pin 5 must be connected, and the shield should follow the plant’s bonding practice.
| Symptom | Likely cause | Fix |
|---|---|---|
| No data in either direction | TX and RX not crossed | Use a null modem |
| Garbled characters | Baud or parity mismatch | Match the port settings |
| Data flows one way only | Broken wire or flow control | Check pins 2, 3 and handshake |
| Works, then stops after a while | Flow control or buffer issue | Check RTS/CTS and software settings |
| Errors when a motor runs | Electrical noise or ground problem | Reroute the cable and review grounding |
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
- AESTECHNO: DB9 Pinout for RS-232, CAN and PROFIBUS: pin tables for all three interfaces.
- Application Note 83: Fundamentals of RS-232 Serial Communications: voltage levels and the 2500 pF limit.
- Digi: Technical Reference, Pinouts for Serial Interfaces: connector and signal reference.
- MicroRidge: Null Modem vs Straight-Through Cable: null modem variants.
- Lammert Bies: RS-232 Null Modem Tutorial: handshaking layouts.
- Lammert Bies: RS-232 Specifications: signal states and limits.
