5
\$\begingroup\$

Just about every time I use a serial port for anything, I only use 3 pins of the usual 9-pin connector (DB9): Tx, Rx, and GND. And when I wire up my microcontroller projects to these ports, I just cross the Tx and Rx signals in the cable, couple the GNDs and it works.

Looking at the pinout descriptions it seems like a the other 6 pins are used for something like flow control and end-point presence-detection. What kinds of devices require you to actually use these pins in practice these days? Why are there so many signals required (seems like overkill), what's the use case for all of them at once?

Could be that I'm just looking for a history lesson here.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Hardware flow control. Clear to Send, Ready to Send, Data Terminal Ready ... all I remember from the old days, is that cables are always wrong, need a lot of troubleshooting. Software flow control (XON/XOFF) is so much easier to wire (that is what you use in three wire set up). \$\endgroup\$
    – jippie
    Feb 12, 2013 at 20:21
  • 7
    \$\begingroup\$ You think 9 pins is bad? The original (full) RS-232 specification calls for a 25-pin connector! \$\endgroup\$
    – Dave Tweed
    Feb 12, 2013 at 20:56
  • 1
    \$\begingroup\$ en.wikipedia.org/wiki/RS-232#Signals \$\endgroup\$
    – starblue
    Feb 13, 2013 at 7:47
  • 2
    \$\begingroup\$ With NXP microcontrollers you can use DTR and RTS to control RESET and BOOT, so you can automatically enter the ROM boot loader for flashing. \$\endgroup\$
    – starblue
    Feb 13, 2013 at 7:49

2 Answers 2

5
\$\begingroup\$

Most of the fancy signals are left over from external telephone modem control. This is back when a computer had to talk to some external box that was then in turn connected to the phone line. Think about most of the other signals as not just transferring data, but controlling a computer-interfaced telephone.

About the only signals beyond RX and TX you are likely to encounter today are RTS and CTS. These are for flow control, and can still be useful today. However, the vast majority of today's devices that still use RS-232 use only the basic RX and TX lines.

Some microcontrollers have UARTs that can optionally use RTS and CTS, because out of band flow control can be a useful thing. I have a project going on right now where I've got two PICs on the same board that need to send data back and forth between each other, and I connected RX, TX, RTS, and CTS. One of the PICs implements this flow control in hardware, so that is particularly easy. On the other I had to do it in firmware since that UART has no such hardware capability.

\$\endgroup\$
3
\$\begingroup\$

The utility of the other signals becomes apparent when you think about RS-232 as being the primary way for networking computers, and mostly over modems. Unlike today's common networking physical protocol, Ethernet, the data are not framed, so any out-of-band communication must happen on another wire, with simple electrical interfaces that could be sent and received by the simple electrical interfaces of the day.

Many of the signals come in pairs which differ only in direction.

RXD (receive data) / TXD (transmit data)

Obvious.

RTS (request to send) / CTS (clear to send), DTR (data terminal ready) / DSR (data set ready)

Hardware flow control, to prevent buffer overflows. These each implement a way to assert "I have something to send (RTS)" and for the other end to answer with "I am ready to receive it (CTS)", with DTR/DSR doing the same thing in the other direction. See What is the difference between DTR/DSR and RTS/CTS flow control? on Stack Overflow.

Or, just abused for whatever purpose deemed convenient. Interoperability wasn't super, back in the day. Everyone had a box with LEDs to indicate which lines were asserted so they could figure out what their hardware was doing, and another box with movable jumpers or switches so they could switch the lines around to get two things to talk.

These days, a lot of equipment is fast enough that there is no chance of a buffer overflow occurring, so flow control may not be necessary.

CD (carrier detect)

CD is essentially the DTE (modem) asserting that whatever it's connected to (phone line) is physically connected, off hook, ready to go, etc. Or again, just abused for whatever was convenient.

RI (ring indicator)

Asserted when the phone line rings.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.