Trouble shooting flow control on a local device

Trouble shooting flow control on a local device.


If flow control does not appear to be working then utilize the stty command to trouble shoot the problem.
The stty command sets certain terminal I/O options for the device that is the current standard input; without arguments, it reports the settings of certain options.

Start whatever process you are using to open the device, such as enabling a getty or sending a print job. Then use the stty command as the process may change the terminal I/O settings when it opens the device.
Any process that is directed to a device can make changes to the default I/O settings if it is programed to do so, but in some cases the process does not have this functionality.

Use the STTY command to view the I/O settings of the device:

stty -a < [device path]
example on the local COM port of a Linux system
# stty -a < /dev/ttyS0

Verify that your process is setting the correct terminal I/O options.
For Software Flow Control make sure ixon and ixoff are enabled.
For Hardware Flow Control make sure ctsrts is enabled.
Read your systems MAN page on stty for all flow control options.

Note that these settings will change as each type of process opens the device. Most process's that use a local device has configuration settings that can change the default values. See your man pages for details on the process you are using ... example # man agetty

Software flow control can be tested with a dumb terminal attached serially to the Perle device. If a file, such as the /etc/services file, is 'cat' to the device the dumb terminal can toggle Software Flow Control using Control-s and Control-q.

Hardware flow control is toggled by signals on the serial port. If your cable is not wired correctly then these signal transistions will not be passed to the Perle serial port. It is very important to note the type of Hardware Flow Control the serially attached device is using.

If the process that opens the device does not set the I/O settings that you require, you can do this manually. If the process that is used on the device terminates then the device's I/O settings will be reset to the system defaults. In order to keep the I/O settings to reset to default when the process ends you can open another process on the device that will keep it open. Then you can use the stty command to set the I/O parameters that are required.

use the 'cat' command to keep the port open and set the speed to 19200 and set XON
# (cat > /dev/null) < /dev/ttyS0 &
# stty 19200 ixon < /dev/ttyS0

See your man pages for more details on stty and termio.

Example from a Sun Solaris serial A port:

# stty -a < /dev/term/a
speed 9600 baud;
rows = 0; columns = 0; ypixels = 0; xpixels = 0;
csdata ?
eucw 1:0:0:0, scrw 1:0:0:0
intr = ^c; quit = ^\; erase = ^?; kill = ^u;
eof = ^d; eol = ; eol2 = ; swtch = ;
start = ^q; stop = ^s; susp = ^z; dsusp = ^y;
rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v;
-parenb -parodd cs8 -cstopb -hupcl cread -clocal -loblk -crtscts -crtsxoff -parext
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
ixon -ixany -ixoff imaxbel
isig icanon -xcase echo echoe echok -echonl -noflsh
-tostop echoctl -echoprt echoke -defecho -flusho -pendin iexten
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel tab3

Below is the man page explaination on a Sun Solaris operating system.

ixon (-ixon)
Enable (disable) START/STOP output control. Output is
stopped by sending STOP control character and started
by sending the START control character.

ixany (-ixany)
Allow any character (only DC1) to restart output.

ixoff (-ixoff)
Request that the system send (not send) START/STOP
characters when the input queue is nearly empty/full.

crtscts (-crtscts)
Enable output hardware flow control. Raise the RTS
(Request to Send) modem control line. Suspends output
until the CTS (Clear to Send) line is raised.

crtsxoff (-crtsxoff)
Enable input hardware flow control. Raise the RTS
(Request to Send) modem control line to receive data.
Suspends input when RTS is low.

clocal (-clocal)
Assume a line without (with) modem control.

Note: changing the I/O settings of a device using stty will only apply to the device in it's open state. If a port is closed the I/O settings will return to default settings. If the application that opens the port cannot set I/O parameters correctly then a process must be placed against the device to keep it continually open so the stty changes are not reset upon a port closure.

Tech Tip: a terminal can toggle XON/XOFF flow control by using Contol+s (stop) and Control+q (start).

Related Articles:
1.) Terminal characteristics for a device.

Article ID:
2/12/2003 12:05:49 PM
Last Modified:
5/4/2006 9:10:56 AM
Issue Type:
Trouble Shooting