In short: A DB9 RS-232 connector carries nine signals, of which TxD (pin 3), RxD (pin 2) and ground (pin 5) do the actual talking, RTS/CTS and DTR/DSR provide hardware handshaking, and every signal is a bipolar voltage where a logic 1 is -3 V to -15 V and a logic 0 is +3 V to +15 V.
Why the DB9 pinout looks the way it does
RS-232 was written in the 1960s to join a computer terminal (the DTE, data terminal equipment) to a modem (the DCE, data communication equipment). The original DB25 connector had 25 pins because modems needed ring detection, secondary channels and clocks. When the IBM PC AT shrank the port to nine pins, it kept only the signals asynchronous serial actually used. That history explains the odd numbering: the pins are not in logical groups, they are simply the survivors of a bigger connector.
Here is the pinout as seen on a PC (DTE) male DB9. A direction of "out" means the DTE drives the line.
| Pin | Name | Direction (DTE) | Purpose |
|---|---|---|---|
| 1 | DCD | in | Modem sees a carrier from the far end |
| 2 | RxD | in | Received data |
| 3 | TxD | out | Transmitted data |
| 4 | DTR | out | "My terminal is powered and ready" |
| 5 | GND | - | Signal reference (not chassis earth) |
| 6 | DSR | in | "My modem or peer is ready" |
| 7 | RTS | out | "I would like to send" |
| 8 | CTS | in | "Go ahead, I can accept data" |
| 9 | RI | in | Ring indicator |
The data pair: TxD and RxD
TxD and RxD are named from the DTE's point of view. A PC drives TxD on pin 3 and listens on pin 2. A modem, being the DCE, does the opposite: its pin 3 is an input and its pin 2 an output. That is the whole reason a straight-through cable works between a PC and a modem, and the whole reason it fails between two PCs, where both ends drive pin 3 and both listen on pin 2.
Key fact: "TxD" always means "transmit from the device that owns the label". Always check whether a datasheet describes a DTE or a DCE before choosing a cable.
Bits are sent asynchronously, least significant bit first, framed by a start bit and one or more stop bits. At 9600 baud one bit lasts 104 µs, so a 10-bit 8N1 frame needs about 1.04 ms and yields roughly 960 bytes per second. The receiver finds the start edge, waits half a bit, then samples each bit centre; typically a UART oversamples 16 times per bit and tolerates around 2 to 3 percent baud mismatch before the last data bit is sampled in the wrong cell.
Voltage levels: why logic 1 is negative
RS-232 is an inverted, bipolar scheme. The idle line (called "mark", logic 1) sits at -3 V to -15 V, and "space" (logic 0, which includes the start bit) is +3 V to +15 V. Control lines use the opposite sense: asserted or ON is positive. A receiver treats anything between -3 V and +3 V as undefined, which gives you 6 V of built-in noise margin that TTL never had. Real drivers swing about ±5 V to ±12 V.
The wide swing is what lets RS-232 survive long, unshielded cables. The classic limit of 15 m comes from a 2500 pF cable-capacitance cap, and slew rate is limited to 30 V/µs so the edges do not radiate or ring into neighbouring wires.
Your logic chips cannot produce these levels from a 3.3 V or 5 V rail. A transceiver such as the MAX232 or its 3.3 V successor MAX3232 uses a switched-capacitor charge pump to generate roughly ±8 V to ±10 V from the logic supply. When you debug a board, a scope on the DB9 pin showing 0 V to 3.3 V instead of a swing around zero means that someone wired the UART straight to the connector with no level shifter.
Hardware handshaking: RTS/CTS and DTR/DSR
Without flow control, a fast sender overruns a slow receiver's buffer. RS-232 gives you two sideband pairs for that.
- RTS/CTS is the per-transfer pair. The DTE raises RTS to say "I want to send". The DCE answers with CTS when it can accept data. Modern embedded designs reuse it as receive-buffer-nearly-full signalling: the receiver deasserts its CTS-facing line when its FIFO passes a threshold, and the sender pauses within a character time.
- DTR/DSR is the per-session pair. DTR says the terminal is powered and a program has opened the port; DSR says the peer is powered up. Many routers use DTR going low to hang up or reset a session.
- DCD and RI are modem-specific: carrier detected, and an incoming call.
Key fact: hardware flow control is stricter than XON/XOFF because it works while binary data (which can contain 0x11 and 0x13) is flowing, and it reacts without waiting for a byte to be decoded.
For the wider protocol view, including UART framing and parity, see our companion article RS-232 serial communication, and for the differential cousin used over longer distances read RS-485 communication basics.
Null-modem wiring: connecting two DTEs
A null-modem cable fakes a pair of modems in the middle. It crosses TxD to RxD, joins grounds straight through, and cross-connects the handshake lines so each side sees the answers it expects.
- Minimum (3-wire): 2↔3, 3↔2, 5↔5. Good enough for a Linux console or most debug UARTs with no flow control.
- Full handshake: add 7↔8 and 8↔7 (RTS to far CTS), and 4↔6 and 6↔4 (DTR to far DSR).
- Loop-back variant: at each end, short RTS to CTS and DTR to DSR (and DCD) locally. The port then believes the peer is always ready, which is the easy fix for software that insists on seeing DSR before opening.
Practical debugging and interview angles
When a serial link is dead, a short routine finds the fault quickly. Measure TxD against pin 5 with a multimeter: an idle open port shows about -5 V to -12 V, and if you read 0 V the port is closed or the transceiver is unpowered. Next, check cable type; a USB-to-serial adapter wired as a DTE will not talk to another PC through a straight cable. Then confirm baud, parity and stop bits at both ends, because a garbled but "alive" stream almost always means a framing mismatch. Finally loop pin 2 to pin 3 on the adapter and type; if the characters echo, the local hardware is fine.
Verification engineers meet the same interface when they bring up a UART in simulation using tools like Synopsys VCS or Siemens Questa. A testbench model only represents the 1/0 logic, and the ±V level shifting lives off-chip in the transceiver, which is a frequent interview question: "where in the system does the voltage inversion happen?" Answer: in the external line driver, not in the UART core. If you want to design or verify serial blocks like these, explore our CourseTron courses, and for hands-on industry training on the full RTL-to-silicon path, see ChipXpert's VLSI training programs.
Ready to go beyond pinouts? Join the CourseTron embedded and VLSI protocols course and build, simulate and debug UART and RS-232 designs with guided labs. Start at coursetron.com/courses.
Frequently asked questions
Which DB9 pins do I need for a basic RS-232 link?
Three: TxD (pin 3), RxD (pin 2) and ground (pin 5). Add RTS/CTS (7 and 8) when you need hardware flow control.
Why does RS-232 use negative voltage for logic 1?
Early telegraph and teleprinter practice used a negative idle ("mark") level. RS-232 inherited it, and the bipolar swing also gives a wide noise margin: a 6 V undefined zone between -3 V and +3 V.
Can I connect a PC and a modem with a null-modem cable?
No. A PC (DTE) and a modem (DCE) already have complementary pin roles, so they need a straight-through cable. A null-modem cable is only for DTE-to-DTE links.
How long can an RS-232 cable be?
The standard's 2500 pF limit corresponds to about 15 m, but at low baud rates over low-capacitance cable, 50 m or more often works in practice. Use RS-485 beyond that.