Hardware manual
Symptoms of No Flow Control
Understanding flow-control theory can be of practical use. The symptom of no flow control is that chunks of
data missing from files sent without the benefit of flow control. When overflow happens, often hundreds or
even thousands of bytes get lost, and all in contiguous chunks.
Hardware vs. Software Flow Control
If feasible, it's best to use "hardware" flow control that uses two dedicated "modem control" wires to send the
"stop" and "start" signals. Hardware flow control at the serial port works like this: The two pins, RTS
(Request to send) and CTS (Clear to send) are used. When the computer is ready to receive data it asserts RTS
by putting a positive voltage on the RTS pin (meaning "Request To Send to me"). When the computer is not
able to receive any more bytes, it negates RTS by putting a negative voltage on the pin saying: "stop sending
to me". The RTS pin is connected by the serial cable to another pin on the modem, printer, terminal, etc. This
other pin's only function is to receive this signal.
For the case of a modem, this "other" pin will be the modem's RTS pin. But for a printer, another PC, or a
non-modem device, it's usually a CTS pin so a "crossover" or "null modem" cable is required. This cable
connects the CTS pin at one end with the RTS pin at the other end (two wires since each end of the cable has a
CTS pin). For a modem, a straight-thru cable is used.
For the opposite direction of flow a similar scheme is used. For a modem, the CTS pin is used to send the
flow control signal to the CTS pin on the PC. For a non-modem, the RTS pin sends the signal. Thus modems
and non-modems have the roles of their RTS and CTS pins interchanged. Some non-modems such as dumb
terminals may use other pins for flow control such as the DTR pin instead of RTS.
Software flow control uses the main receive and transmit data wires to send the start and stop signals. It uses
the ASCII control characters DC1 (start) and DC3 (stop) for this purpose. They are just inserted into the
regular stream of data. Software flow control is not only slower in reacting but also does not allow the sending
of binary data unless special precautions are taken. Since binary data will likely contain DC1 and DC3
characters, special means must be taken to distinguish between a DC3 that means a flow control stop and a
DC3 that is part of the binary code. Likewise for DC1.
4.7 Data Flow Path; Buffers
It's been mentioned that there are 3 buffers for each direction of flow (3 pairs altogether): 16-byte FIFO
buffers (in the UART), a pair of larger buffers inside a device connected to the serial port (such as a modem),
and a pair of buffers (say 8k) in main memory. When an application program sends bytes to the serial port
they first get stashed in the transmit serial port buffer in main memory. The other member of this pair consists
of a receive buffer for the opposite direction of byte-flow. Here's an example diagram for the case of browsing
the Internet with a browser. Transmit data flow is left to right while receive flow is right to left. There is a
separate buffer for each direction of flow.
application 8k-byte 16-byte 1k-byte tele-
BROWSER ------- MEMORY -------- FIFO --------- MODEM -------- phone
program buffer buffer buffer line
For the transmit case, the serial device driver takes out say 15 bytes from this transmit buffer (in main
memory), one byte at a time and puts them into the 16-byte transmit buffer in the serial UART for
transmission. Once in that transmit buffer, there is no way to stop them from being transmitted. They are then
Serial HOWTO
Symptoms of No Flow Control 15