RS-232 Serial Port Circuit Design
RS-232 is one of the oldest interface standards still in daily use, and it survives because it is simple, robust and understood by every platform. It is also an unusual interface electrically: the signals swing between positive and negative voltages, the logic is inverted, and the driver must withstand a short circuit to any other line without damage.
What the Standard Actually Requires
A valid RS-232 driver produces at least plus five volts for a logic zero and at least minus five volts for a logic one, with a typical swing of plus and minus twelve volts. A receiver must accept anything above plus three volts as a zero and anything below minus three volts as a one, and it must tolerate plus or minus twenty five volts without damage.
The inversion is the part that surprises people who are used to logic levels. An idle line sits at the negative voltage, and the start bit is the transition to the positive voltage. A receiver that is wired the wrong way round reads inverted data, and the symptom is garbage characters that look like a baud rate error.
The driver must also survive a short between two signal lines, which is what happens when a cable is plugged in while the equipment is running. The standard requires the driver to limit its output current, and a device that meets it can be shorted to ground indefinitely without damage.
The level shifter and charge pump
A modern RS-232 interface chip combines the drivers, the receivers and a charge pump that generates the positive and negative rails from a single five or three point three volt supply. The charge pump needs flying capacitors and reservoir capacitors, and their values and placement determine the ripple and the drive capability.
The flying capacitors should be placed with short, direct traces to the chip. A long trace adds inductance that slows the charge transfer and reduces the output voltage, which shows up as a reduced swing that still works on a short cable and fails on a long one.
The reservoir capacitors set the transient response. The current drawn from the rails is not continuous: it is a series of packets as each bit is transmitted, so the capacitors have to supply the short pulses without letting the rail sag. Ceramic capacitors close to the pins are better than electrolytics on the far side of the board.

Data Rates, Cable Length and Capacitance
The standard was written for a maximum cable capacitance of about two thousand five hundred picofarads, which corresponds to fifteen metres of ordinary cable at the classic data rate. The limit is capacitance rather than length, so a low capacitance cable reaches further at the same rate.
Higher data rates reduce the distance. At a hundred and fifteen kilobaud, a cable of a few metres is the practical limit with a standard driver, while a low capacitance cable of twenty metres can still work at a slower rate. The rule is to keep the rise time a fraction of the bit period.
A slow slew rate helps on long cables and hurts on short ones. Many interface chips offer a slew limited version for reduced electromagnetic emission, and it should be used when the data rate allows it. The general approach to controlling the edges of a fast digital signal is described in our guide to mixed signal board design.
ESD protection and Surge
An RS-232 port is often the only connection that leaves the enclosure, so it takes the brunt of any electrostatic discharge. The connector shell and the signal pins both need a path to ground, and the shell should be tied to the chassis rather than to the signal ground.
A transient suppressor at the connector, followed by a small series resistance and the internal clamp of the interface chip, handles most events. The series resistance is important: it limits the current that reaches the chip and allows the suppressor to do its work before the on chip clamp starts conducting.
Earth potential differences are a second hazard on a long cable between two pieces of equipment. An isolated interface chip, or a pair of optocouplers on the data lines, breaks the loop and removes the current path that would otherwise flow through the signal ground.

The Connector and Pinout Reality
The standard defines a twenty five pin connector, but most equipment uses a nine pin one, and a large part of the industry uses only three wires: transmit, receive and ground. The remaining pins carry handshake signals that many devices ignore.
The data terminal and data communication roles are not interchangeable. Pins two and three are transmit and receive with the roles swapped between the two ends, so a straight cable between two computers does not work; a null modem cable that crosses the pair is needed.
Where the handshake pins are used, their absence is a common reason for a link that does not start. Some software waits for the clear to send input, and a cable that does not provide it leaves the port idle. A loop back of the handshake pins at the connector is an old and effective remedy.
Testing a Serial Port
Test with a loop back connector first. Joining the transmit pin to the receive pin makes every character sent return to the terminal, which proves the port, the driver and the software configuration without involving a second device.
An oscilloscope on the transmit pin shows the swing and the shape of the waveform. A swing that is smaller than expected points to the charge pump or its capacitors, while a waveform with rounded edges points to too much cable capacitance for the data rate.
The baud rate and the framing have to match exactly. A rate that is close but not equal produces occasional errors that appear as corrupted characters at long intervals, which is a particularly annoying fault to find. Dividing the input clock to generate the rate, rather than using an independent oscillator, keeps the two ends in step.
Layout Notes for a Serial Interface
Keep the charge pump capacitors and the interface chip in one small area with a solid ground plane. The switching current of the charge pump is a source of noise for the rest of the board, so the area should not be under or next to a sensitive analog circuit.
Route the transmit and receive pairs away from high speed clocks and from the crystal. A serial line at a hundred and fifteen kilobaud is slow, but its edge rate still makes it a wideband source that can couple into an analog front end.
The connector should be at the edge of the board with its shield tied to the chassis, and the ground of the interface chip should join the system ground at one point. The release checks that ensure these details are correct on every board are collected in our PCB design release checklist, and the visual inspection points we use on a finished assembly are in judging PCB quality.
FAQ
Why does my RS-232 link work on a short cable and fail on a long one? Cable capacitance slows the edges and reduces the swing. Use a low capacitance cable, reduce the data rate and check the charge pump capacitors.
Can I connect a three point three volt device directly to RS-232? No. The negative and positive twelve volt swing exceeds the logic input range and the polarity is inverted. A level shifter is required.
Do I really need the handshake pins? Only if the software waits for them. Many devices work with three wires, and looping the handshake pins at the connector solves the rest.



