EINTR.net / serial

RS232 Serial Link - Pin Functions

Data Pins

DB9 # DB25 # Name Long Name DTE Direction DCE
3 2 TD Transmit Data Serial data stream transmitted by the DTE device.
The actual format, framing of the serialized data and it's baud rate can be changed using a variety of termios flags.
There is no agreement protocol for the format of the data between the peers, they must be set manually to the same settings on both ends. (This is particulary true when connecting two DTE together.)
A reasonnable often use default is 9600 baud, 8 bits characters, no parity and 1 stop bit.
>>> Serial data stream received by the DCE device.
Note that recent modem will be able to automaticaly sense and adapt the baud rate and parity to match the DTE (but not until they receive at least one character).
2 3 RD Receive Data Serial data stream received from the DCE device.
Same note as above apply.
<<< Serial data strem sent to the DTE device.
Same note as above apply.
5 7 GND Signal Ground Use as the neutral base by both side for the +/- voltage level for the other pins. This is needed for the electrical part of the RS232 standard. Same as DTE.

Control Pins

DB9 # DB25 # Name Long Name DTE Direction DCE
1 8 DCD Data Carrier Detect The DCE has established a communication with a remote DCE device.
In blocking io, the open call on a tty will wait until this signal is received to return. [cua is not limited in this way]
If the hupcl termios flag is set, all process attached to this serial port will received an SIGHUP signal (default action: terminate process) when this signal is drop.
[Those behaviors can be changed with the clocal termios flag.
<<< Raised when an carrier communication is established with a remote DCE device.
For a modem calling an other modem, it's when the CONNECT message is received.
It also mean that for now on, TD and RD are transmitted/received to/from the carrier. [No longer used to control the modem behavior.]
You are in communication with a remote host.
4 20 DTR Data Terminal Ready The DTE is ready an it's serial port activated.
This signal is raised when a process open the serial port.
>>> Same as DTE. Also, in modem this signal is usually required to enable auto-answering capabilities (S0 register). [The modem will not answer calls until the PC is ready to accept them.]
6 6 DSR Data Set Ready The DCE is ready and on.
In blocking io, the open call on a tty will wait until the signal is received to return. [Again, clocal change this.]
<<< Same as DTE.
7 4 RTS Request To Send The poorly named signal1.
When hardware flow control is enabled, this signal is raised by the DTE when it is ready to receive new data from the DCE device. Lowered when the computer cannot cope fast enough with the data comming in.
Gives the DTE control of the flow of data coming from the DCE.
The termios flag crtscts enables hardware flow control.
>>> Same as DTE.
8 5 CTS Clear To Send When hardare flow control is enabled, if this signal is raised, the DTE can send data to the DCE. Lowered, the DTE must stop sending data.
Gives the DCE control of the flow of data coming from the DTE.
The termios flag crtscts enables hardware flow control.
<<< Same as DTE.
New modems have a carrier speed lower than the serial speed (e.g: 32000 baud connection but 115200 baud serial port). This creates a bottleneck when the DTE is sending data so CTS is very handy to tell the DTE to stop while it process it's current buffer through the slower link.
If you where to run the serial port at a speed lower than the carrier link, flow control of the transmitted data would not be as much usefull (but it would be so slow [19200 baud and lower]).

Notes:

  1. I have heard that at first, the RS232 specification had flow control in only one direction: from the DTE to the DCE. So the DTE was raising "Request to Send" when it had data to send and the DCE was acknoledging the request by raising "Clear to Send", then the DTE was allowed to send.
    But then, they figured out that a bidirectionnel specification needed flow control in both direction and that a 2 signals handshaking for one direction was overkill so they changed the function of the RTS signal to provide flow control from the DCE to the DTE but its name remains and keep confusing people.

(c) 2002 Hugo Villeneuve
$Id: pins_meanings.html,v 1.5 2024/05/28 06:39:48 harpagon Exp $