v0.26, March 2003
+ Copyright (c) 1998-2003 by David S. Lawyer
+
Please freely copy and distribute (sell or give away) this document
in any format. Send any corrections and comments to the document
@@ -123,7 +124,7 @@ provided that you:
- If it's not a translation: Email a copy of your derivative work
(in a format LDP accepts) to the author(s) and maintainer (could be
the same person). If you don't get a response then email the LDP
- (Linux Documentation Project): submit@linuxdoc.org.
+ (Linux Documentation Project): submit@en.tldp.org.
- License the derivative work in the spirit of this license or use
GPL. Include a copyright notice and at least a pointer to the
license used.
@@ -141,9 +142,9 @@ them. Since this is free documentation, it should be obvious that I
cannot be held legally responsible for any errors.
Trademarks.
- Any brand names (starts with a capital letter) should be assumed to
-be a trademark). Such trademarks belong to their respective owners.
-
+
Any brand names (starts with a capital letter such as MS Windows)
+should be assumed to be a trademark). Such trademarks belong to their
+respective owners.
"Hayes" is a trademark of Microcomputer Products Inc. I use
@@ -175,31 +176,27 @@ or two old, check to see that you have the latest version. Please
send me any other info that you think belongs in this document.
New Versions of this HOWTO
- New versions of this Modem-HOWTO come out every few months. The
-modem situation is rapidly changing (and I'm still learning). Your
-problem might be solved in the latest version. It will be available
-to browse and/or download at LDP mirror sites. For a list of such
-sites see: If you
-only want to quickly compare the date of this the version v0.25, September 2002 with
+ New versions of this Modem-HOWTO should come out every few months.
+Your problem might be solved in the latest version. It will be
+available to browse and/or download at LDP mirror sites. For a list
+of such sites see: If you
+only want to quickly compare the date of this the version v0.26, March 2003 with
the date of the latest version go to:
New in Recent Versions
- For a full revision history going back to v0.00 see the source file
-(in linuxdoc format) at
- For a full revision history going back to the first version see
+the source file (in linuxdoc format) at .
+v0.26 March 2003: USB clarity improved, v.92 modem "on hold" supported?,
+3Com AT codes
v0.25 September 2002: Must restart minicom after configuring it unless
you used the -s option. HCF is not an all-software modem as was
incorrectly claimed. Better clarity for "Quick Install" and 56k
modems. Does my PC have a modem?
v0.24 June 2002: new callback link, "You are already online" error,
fixed several typos reported by Francesco Ronconi
-v0.23 January 2002: dropped connection w/V.90, X3 to force dialing if
- NO DIALTONE, more on USB, wvdial added to "Trying Out Your Modem",
- major revision to "Antique Modems", several broken links fixed,
- better clarity re RAS, digital modems.
What is a Modem ?
A modem is a device that lets one send digital signals over an
@@ -215,10 +212,11 @@ may phone in to them and use their computer. This is called
There are four basic types of modems for a PC: external, USB, internal
and built-in. The external and USB set on your desk outside the PC
while the other two types are not visible since they're inside the PC.
-The external modem plugs into a connector on the back of the PC known
-as a "serial port". The USB modem plugs into the USB bus cable. See
-[. The internal modem is a card that
-is inserted inside the computer. The built-in modem is part of the
+Sometimes the USB type is called "USB external". The external serial
+modem plugs into a connector on the back of the PC known as a "serial
+port". The USB modem plugs into the USB bus cable. See ][. The internal modem is a card that is
+inserted inside the computer. The built-in modem is part of the
motherboard and is thus built into the computer. It's is just like an
internal modem except it can't be removed or replaced. As of 2001,
built-in modems are primarily for laptops. What is said in this HOWTO
@@ -226,21 +224,30 @@ regarding internal modems will generally apply also to built-in
modems.
For a more detailed comparison see ][. When you get an internal, built-in, or USB modem,
+vs. Internal">. When you get an internal or, built-in, modem,
you also get a dedicated serial port (which can only be used with the
modem and not with anything else such as another modem or a printer).
In Linux, the serial ports are named ttyS0, ttyS1, etc. (usually
corresponding respectively to COM1, COM2, etc. in Dos/Windows). For
the new devfs they are all in the /dev/ttys/ directory and named 0, 1,
etc. See ][ for
-more details on modems and serial ports.
+more details on modems and serial ports. With a USB modem, the driver
+simulates a serial port at say /dev/usb/asm/0.
Modems usually include the ability to send Faxes (Fax Modems). See
][ for a list of fax software. "Voice" modems
can work like an automatic answering machine and handle voicemail.
-See ][.
+See ][.
-] Does My Computer Contain a Modem ?
+The v.92 protocol can put the modem "on hold" when someone makes an
+ordinary voice call to your telephone, provided that you have "call
+waiting" from your telephone company. Thus you can get a phone call
+while online. As of Jan. 2003 Linux doesn't seem to support it. If
+this is the latest version of this HOWTO, let me know about any
+Linux support for it. Some linmodem drivers may support it (but what
+if you have a hardware modem ?).
+
+ Does My Computer Contain an Internal Modem ?
Internal modems usually have a pair of modular telephone jacks on
the back of the computer. They should be right next to each other and
look like a jack on the wall of a house where a telephone plugs in.
@@ -403,13 +410,13 @@ external modem and plug it in. But if you get the right internal
modem it may be just as easy.
Is a Driver Needed ?
- Hardware modems (including all external modems) don't really need
-any modem driver. But any software modem (winmodem, linmodem) must
-have a modem driver (if it exists for Linux). The serial port the
-modem resides on does need a driver and it's supplied either as a
-Linux serial module or compiled into the kernel. Any serial driver
-for a PCI Modem should install automatically since they are detected
-by system software.
+
Hardware modems (including all serial external modems) don't
+really need any modem driver. But any software modem (winmodem,
+linmodem) must have a modem driver (if it exists for Linux). The
+serial port the modem resides on does need a driver and it's supplied
+either as a Linux serial module or compiled into the kernel. Any
+serial driver for a PCI Modem should install automatically since they
+are detected by system software.
Software modems require software to run them and obviously do need a
driver. The drivers for MS Windows are *.exe programs which will not
@@ -469,7 +476,7 @@ program and configure the modem itself.
the PC and inserting the modem card into a vacant slot on the
motherboard. There are modems for PCI slots, other modems for the
older ISA slots, and ARM software "modems" for the new small AMR slot.
-Some new PC don't have any ISA slots. Only some newer PCs will have
+Some new PCs don't have any ISA slots. Only some newer PCs will have
ARM slots. While external modems plug into the serial port (via a
short cable) the internal modems have the serial port built into the
modem. In other words, the modem card is both a serial port and a
@@ -696,11 +703,14 @@ one of them.
USB = Universal Serial Bus. Some USB modems work with Linux and
some don't. Linux has support for modems that conform to the USB
Communication Device Class Abstract Control Model (= USB CDC ACM).
-There's a module for ACM named acm.o. See the /usb/acm... document in
+There's a module for ACM named acm.o. See the /usb/acm.txt document in
the kernel documentation directory (/usr/share/doc/kernel-doc-2.4.x in
Debian, perhaps /usr/doc/kernel... in some distributions). The ACM
-serial port for the first (0th) such modem is (with devfs) is:
-/dev/usb/acm/0. Otherwise it might be /dev/usb/ttyACM0.
+"serial port" for the first (0th) such modem is: /dev/usb/acm/0 or
+possibly /dev/usb/ttyACM0. This should be the case regardless of
+whether or not you use the new "device file system". It's not really
+a serial port, but the driver makes it look like a serial port to
+software which uses the modem.
Which Internal Modems might not work with Linux
@@ -901,6 +911,7 @@ Sept. '00: data flow diagram
Dec. '00 flow control +
July '01 done -> down
Feb. '02 4k buffer -> 8k
+Feb '03: UARTs with auto flow control. Rewrite of Flow Control.
-->
You don't have to understand the basics to use and install a
@@ -940,7 +951,7 @@ name="Modulation Details">.
What is a Serial Port ?
Intro to Serial
- The serial port is an I/O (Input/Output) device.
+
The UART serial port (or just "serial port for short" is an I/O (Input/Output) device.
Since modems have a serial port between them and the computer,
it's necessary to understand the serial port as well as the modem.
@@ -1051,7 +1062,7 @@ which ttyS. This mapping of names (such as ttyS1) to I/O addresses
(and IRQ's) may be both set and viewed by the "setserial" command.
See [. This does
]
+hold only 16 incoming bytes. If the CPU fails to remove such received
+bytes promptly, then there will not be any space left for any more
+incoming bytes and the small buffer may overflow (overrun) resulting
+in a loss of data bytes.
-For an external modem, there is no way (such as flow control) to stop
+
+For an external modem, there may be no way (such as flow control) to stop
the flow rapidly enough to prevent this. For an internal modem the
16-byte FIFO buffer is on the same card and a good modem will not
write to it if it's full. Thus a good internal modem will not overrun
@@ -1104,11 +1115,11 @@ being overrun. This is one advantage of an internal modem over an
external.
Interrupts are also issued when the serial port has just sent out all
-16 of its bytes from its small transmit buffer out the external cable.
+of its bytes from its small transmit buffer out the external cable.
It then has space for 16 more outgoing bytes. The interrupt is to
notify the CPU of that fact so that it may put more bytes in the small
transmit buffer to be transmitted. Also, when a modem control line
-changes state an interrupt is issued.
+changes state, an interrupt is issued.
The buffers mentioned above are all hardware buffers. The serial port
also has large buffers in main memory. This will be explained later
@@ -1201,8 +1212,9 @@ report the modem-to-modem speed as (for example): CARRIER 28800.
If you have an internal modem you would not expect that there would be
any speed limit on the DTE speed from your modem to your computer
since you modem is inside your computer and is almost part of your
-computer. But there is since the modem contains a dedicated serial
-port within it.
+computer. But there usually is since the modem contains a dedicated
+serial port within it. On some software modems there is no such speed
+limit.
It's important to understand that the average speed is often less than
the specified speed, especially on the short DTE computer-to-modem
@@ -1224,7 +1236,7 @@ id="speed_" name="What Speed Should I Use">.
Flow control means the ability to slow down the flow of bytes in a
wire. For serial ports this means the ability to stop and then
restart the flow without any loss of bytes. Flow control is needed
-for modems to allow a jump in instantaneous flow rates.
+for modems and other hardware to allow a jump in instantaneous flow rates.
Example of Flow Control
For example, consider the case where you connect a 33.6k external
@@ -1259,18 +1271,19 @@ which is already compressed and can't be compressed further. Now
let's consider the opposite extreme where the modem is compressing the
data with a high compression ratio. In such a case the modem might
need an input flow rate of say 115.2k bps to provide an output (to the
-phone line) of 33.6k bps (compressed data). The compression ratio is
-3.43 (115.2/33.6) which is much higher than average. In this case the
-modem is able to compress and the 115.2 bps PC-to-modem flow and send
-the same data out on the phone line at 33.6bps. There's no need for
-flow control here. But such a high compression ratio rarely happens
-so that most of the time flow control is needed to slow down the flow
-on the 115.2 bps PC-to-modem cable. The flow is stopped and started
-so that the average flow is usually well under the "on" flow of 115.2
-bps.
+phone line) of 33.6k bps (compressed data). This compression ratio is
+3.43 (115.2/33.6). In this case the modem is able to compress and
+the 115.2 bps PC-to-modem flow and send the same data (in compressed
+form) out the phone line at 33.6bps. There's no need for flow control
+here so long as the compression ratio remains higher that 3.43. But
+the compression ratio varies from second to second and is likely to
+drops below 3.43. Thus, some of the time flow control is needed to
+slow down the average flow on the 115.2 bps PC-to-modem cable. The
+flow is stopped and started so that the average flow is usually lower
+than the "on" flow of 115.2 bps.
In the above example the modem was an external modem. But the same
-situation exists (as of late 2000) for most internal modems. There is
+situation exists (as of early 2003) for most internal modems. There is
still a speed limit on the PC-to-modem speed even though this flow
doesn't take place over an external cable. This makes the internal
modems compatible with the external modems.
@@ -1280,23 +1293,25 @@ a modem. But there is also flow control which is used for the
opposite direction of flow: from a modem (or other device) to a
computer. Each direction of flow involve 3 buffers: 1. in the modem
2. in the UART chip (called FIFOs) 3. in main memory managed by the
-serial driver. Flow control protects certain buffers from
-overflowing. The small UART FIFO buffers are not protected in this
-way but rely instead on a fast response to the interrupts they issue.
-FIFO stand for "First In, First Out" which is the way it handles
-bytes. All the 3 buffers use the FIFO rule but only one of them also
-uses it as a name. This is the essence of flow control but there are
-still some more details.
+serial driver. Flow control protects all buffers (except the FIFOs)
+from overflowing.
+
+Under Linux, the small UART FIFO buffers are not protected in this way
+but rely instead on a fast response to the interrupts they issue.
+Some UART chips can be set to do hardware flow control to protect
+their FIFOs but Linux (as of early 2003) doesn't seem to support it.
+FIFO stand for "First In, First Out" which is the way it handles bytes
+in a queue. All the 3 buffers use the FIFO rule but only one of them
+is named "FIFO". This is the essence of flow control but there
+are still some more details.
-You don't often need flow control in the direction from the modem to a
-PC. For complex example of a case where it's needed see "Complex Flow
-Control Example" in the Serial-HOWTO. But if you don't have a high
-enough speed set between the modem and the computer (serial port
-speed) then you do need to slow down the flow coming into the modem
-from the telephone line. To do this your modem must tell the other
-modem to stop sending. See [.
+If you have set the highest PC-to-modem speed, you may not need flow
+control in the direction from the modem to a PC. For complex example
+of a case where it's needed see "Complex Flow Control Example" in the
+Serial-HOWTO. To slow down this incoming flow, your modem must tell
+the other modem to stop sending. See ][.
@@ -1304,11 +1319,24 @@ Flow Control">.
] 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.
-
-Modern modems almost always use hardware flow control between the
-modem and the serial port.
-
+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 date 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 the signal.
+
+For the case of a modem this "other" pin will be the modem's RTS pin
+(same pin label as the PC). But for a printer or terminal, it will be
+a CTS pin and requires "crossover" or "null modem" cable so as to
+connect the CTS pin at one end with the RTS pin at the other end. 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 and the RTS pin a receive it. For a
+non-modem, the roles of the RTS and CTS pins are interchanged.
Software flow control uses the main receive and transmit wires to send
the start and stop signals. It uses the ASCII control characters DC1
@@ -1326,19 +1354,19 @@ modem (hardware) and software support
Symptoms of No Flow Control
Understanding flow-control theory can be of practical use. For
example I used my modem to access the Internet and it seemed to work
-fine. But after a few months I tried to send long files from my PC to
-an ISP and a huge amount of retries and errors resulted (but
-eventually Kermit could send a long file after many retries).
-Receiving in the other direction (from my ISP to me) worked fine. The
-problem turned out to be a modem with broken flow control. My modem's
-buffer was overflowing (overrunning) on long outgoing files since no
-"stop" signal was ever sent to my computer to halt sending to the
-modem. There was no problem in the direction from the modem to my
-computer since the capacity (say 115.2 kbps) was always higher than the
-flow over the telephone line. But it was a problem in the other
-direction where the PC could send at 115.2 kbps until it overran the
-modem). The fix was to enable flow control by putting into the init
-string an enable-flow-control command for the modem.
+fine. But after a few months I tried to send out long files from my PC
+and a huge amount of retries and errors resulted but it finally
+succeeded. Receiving in the other direction (from my ISP to me) worked
+fine. The problem turned out to be a modem with flow control disabled.
+My modem's buffer was overflowing (overrunning) on long outgoing files
+since no "stop" signal was ever sent to my computer to halt sending to
+the modem. There was no problem in the direction from the modem to my
+computer since the capacity (say 115.2 kbps) was always higher than
+the flow from the telephone line. But it was a problem in the other
+direction where the PC would send at 115.2 kbps and the modem couldn't
+handle this high flow resulting in overruns of the modem's buffer.
+The fix was to enable flow control by putting into the modem's init
+string an enable-flow-control command.
Modem-to-Modem Flow Control
This is the flow control of the data sent over the telephone lines
@@ -1350,48 +1378,53 @@ used.
Data Flow Path; Buffers
- Much has been explained about this including flow control, a pair
-of 16-byte FIFO buffers (in the UART), and a pair of larger buffers
-inside a device connected to the serial port (such as a modem). But
-there is still another pair of buffers. These are large buffers
-(perhaps 4k) in main memory also known as serial port buffers. When
-an application program sends bytes to the serial port
-(and modem)they first get stashed in the transmit serial port buffer in main
-memory. The pair consists of both this transmit buffer and 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.
+
It's been mention 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
+pair consists of both the transmit buffer and 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 4k-byte 16-byte 1k-byte tele-
-BROWSER ------- MEMORY -------- UART --------- MODEM -------- phone
+application 8k-byte 16-byte 1k-byte tele-
+BROWSER ------- MEMORY -------- FIFO --------- MODEM -------- phone
program buffer buffer buffer line
-The serial device driver takes out say 16 bytes from this transmit buffer,
-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
-transmitted to the modem
-which also has a fair sized (say 1k) buffer. When the device driver
-(on orders from flow control) stops the flow of outgoing bytes from
-the computer, what it actually stops is the flow of outgoing bytes
-from the large transmit buffer in main memory. Even after this has
-happened and the flow to the modem has stopped, an application program
-may keep sending bytes to the 4k transmit buffer until it becomes
-fill.
+For the transmit case, the serial device driver takes out say 16 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 transmitted to the
+modem or (other device connected to the serial port) which also has a
+fair sized (say 1k) buffer. When the device driver (on orders from
+flow control) stops the flow of outgoing bytes from the computer, what
+it actually stops is the flow of outgoing bytes from the large
+transmit buffer in main memory. Even after this has happened and the
+flow to the modem has stopped, an application program may keep sending
+bytes to the 8k transmit buffer until it becomes fill. At the same
+time, the bytes stored in the FIFO and MODEM continue to be sent out
+until these buffers empty.
-When it gets fill, the application program can't send any more bytes
-to it (a "write" statement in a C_program blocks) and the application
-program temporarily stops running and waits until some buffer space
-becomes available. Thus a flow control "stop" is ultimately able to
-stop the program that is sending the bytes. Even though this program
-stops, the computer does not necessarily stop computing. It may
-switch to running other processes while it's waiting at a flow control
-stop. The above was a little oversimplified since there is another
-alternative of having the application program itself do something else
-while it is waiting to "write".
+When the memory buffer gets fill, the application program can't send
+any more bytes to it (a "write" statement in a C_program blocks) and
+the application program temporarily stops running and waits until some
+buffer space becomes available. Thus a flow control "stop" is
+ultimately able to stop the program that is sending the bytes. Even
+though this program stops, the computer does not necessarily stop
+computing since it may switch to running other processes while it's
+waiting at a flow control stop.
+
+The above was a little oversimplified in two ways. First, some UARTs
+can do automatic hardware flow control which can stop the transmission
+out of the FIFO buffers if needed (not yet supported by Linux).
+Second, while an application process is waiting to write to the
+transmit buffer, it could possibly perform other tasks.
Modem Commands
@@ -1432,7 +1465,7 @@ id="modem_conf" name="Modem Configuration">
Serial Driver Module
The device driver for the serial port is the software that
operates the serial port. It is now provided as a serial module.
->From kernel 2.2 on, this module will normally get loaded automatically
+From kernel 2.2 on, this module will normally get loaded automatically
if it's needed. In earlier kernels, you had to have
IO & IRQ Overview
@@ -1614,7 +1648,7 @@ got them working anyway). The 2.4 serial driver will read the id
number digitally stored in the serial hardware to determine how to
support it (if it knows how). It should assign an I/O address to it,
determine it's IRQ, etc. So you don't need to use "setserial" for it.
-
+
More info on PCI
PCI ports are not well standardized. Some use main memory for
communication with the PC. Some require special enabling of the IRQ.
@@ -2174,11 +2208,12 @@ stty -F /dev/ttyS2 crtscts
If you want to see if flow control is enabled do the following: In
-minicom (or the like) type AT&V to see how the modem is configured
-and look for &K3 which means hardware flow control. Then without
-exiting the communications program (such as minicom) see if the device
-driver knows about it by typing: stty -F /dev/ttyS2 -a. Look for
-"crtscts" (without a disabling minus sign).
+minicom (or the like) type AT&V (or ATI4 on 3Com modems) to see
+how the modem is configured and look for &K3 (or &H1 on 3Com
+modems) which means hardware flow control. Then without exiting the
+communications program (such as minicom) see if the device driver
+knows about it by typing: stty -F /dev/ttyS2 -a. Look for "crtscts"
+(without a disabling minus sign).
Speed Settings
Besides flow control there is speed. See [minicom -o]
to start minicom without
-restoring the saved modem profile. Then type at&v to
-display the profile. To exit minicom without disturbing this profile,
-use the q (quit) command for exiting without resetting.
+restoring the saved modem profile. Then type at&v (or
+atI4 on 3Com modems) to display the profile. To exit minicom without
+disturbing this profile, use the q (quit) command for exiting without
+resetting.
The above may not work for various reasons. If the modem has been set
not to echo result codes it may not even display any profile. If there
@@ -2497,6 +2533,7 @@ interface and makes it easy to deal with a huge number of devices.
The device names have all changed as well. But there's an option to
continue using the old names. For a detailed description of it see:
+Also see the kernel documentation tree: filesystems/devfs.
The name changes (if used) are: ttyS2 becomes tts/2 (Serial port),
tty3 becomes vc/3 (Virtual Console), ptyp1 becomes pty/m1 (PTY
@@ -2513,10 +2550,10 @@ in the /dev directory.
There formerly was a "cua" name for each serial port and it behaved
just a little differently. For example, ttyS2 would correspond to
-cua2. The cua major number was 5 and minor numbers started at 64.
-You may still have the cua devices in your /dev directory but they are
-now deprecated. Their drivers behave slightly different than for the
-ttyS ones. name="cua Device Obsolete">."')
+cua2. It was mainly used for modems. The cua major number was 5 and
+minor numbers started at 64. You may still have the cua devices in
+your /dev directory but they are now deprecated. For details see
+Modem-HOWTO, section: cua Device Obsolete.
Dos/Windows use the COM name while the IRQs near end ttyS0 -> ttyS1 + clarity
Nov. 2000: auto_irq may work on the 2nd try
Dec. 2000: saving state of serial module
June 2001 OK to use setserial with Laptops
+Nov. 2002 Debian's /var/lib/serial.conf
-->
This part is in 3 HOWTOs: Modem, Serial, and Text-Terminal. There
are some minor differences, depending on which HOWTO it appears in.
@@ -2724,14 +2762,15 @@ IRQ's but this doesn't always work right either. In one case it first
gave the wrong irq but when the command was repeated it found the
correct irq. In versions of setserial >= 2.15, the results of your
last probe test could be automatically saved and put into the
-configuration file /etc/serial.conf which will be used next
-time you start Linux. At boot-time when the serial module loads (or
-the like), a probe for UARTs is made automatically and reported on the
-screen. But the IRQs shown may be wrong. The second report of the
-same is the result of a script which usually does no probing and thus
-provides no reliable information as to how the hardware is actually
-set. It only shows configuration data someone wrote into the script
-or data that got saved in /etc/serial.conf.
+configuration file /etc/serial.conf or
+/var/lib/serial.conf which will be used next time you start
+Linux. At boot-time when the serial module loads (or the like), a
+probe for UARTs is made automatically and reported on the screen. But
+the IRQs shown may be wrong. The second report of the same is the
+result of a script which usually does no probing and thus provides no
+reliable information as to how the hardware is actually set. It only
+shows configuration data someone wrote into the script or data that
+got saved in /etc/serial.conf.
It may be that two serial ports both have the same IO address set in
the hardware. Of course this is not permitted but it sometimes
@@ -3340,8 +3379,8 @@ waiting for an incoming phone call. There is a supplemental program
called and
@@ -3909,7 +3948,7 @@ your computer (PC-to-modem speed). This is sometimes called "DTE
speed" where "DTE" stands for Data Terminal Equipment (Your computer
is a DTE.) You need to set this speed high enough so this part of the
signal path will not be a bottleneck. The setting for the DTE speed
-is the maximum speed of this link. Most of the time it should
+is the maximum speed of this link. Most of the time it will likely
actually operate at lower speeds.
For an external modem, DTE speed is the speed (in bits/sec) of the
@@ -3917,9 +3956,10 @@ flow over the cable between you modem and PC. For an internal modem,
it's the same idea since the modem also emulates a serial port. It
may seem ridiculous having a speed limit on communication between a
computer and a modem card that is directly connected inside the
-computer to a much higher speed bus. But it's that way since the
-modem card probably includes a dedicated serial port which does have
-speed limits (and settable speeds).
+computer to a much higher speed bus. But it's usually that way since
+the modem card probably includes a dedicated serial port which does
+have speed limits (and settable speeds). However, some software
+modems have no such speed limits.
Speed and Data Compression
What speed do you choose? If it were not for "data compression"
@@ -3929,9 +3969,9 @@ computer and encodes them into a fewer number of bytes. For example,
if the flow (speed) from the PC to the modem was 20,000 bytes/sec
(bps) and the compression ratio was 2 to 1, then only 10,000 bytes/sec
would flow over the telephone line. Thus for a 2:1 compression ratio
-you need to set the DTE speed to double the maximum modem speed on the
-phone line. If the compression ratio were 3 to 1 you need to set it 3
-times faster, etc.
+you would need to set the DTE speed to double the maximum modem speed
+on the phone line. If the compression ratio were 3 to 1 you would
+need to set it 3 times faster, etc.
Where do I Set Speed ?
This DTE (PC-to-modem) speed is normally set by a menu in your
@@ -3946,6 +3986,7 @@ different speeds, then they couldn't communicate with each other.
Can't Set a High Enough Speed
Speeds over 115.2k
The top speed of 115.2k has been standard since the mid 1990's.
@@ -3965,17 +4006,19 @@ setserial (unless the serial driver does this for you). The software
will then use a divisor of 1 to set the highest speed. All this will
hopefully be supported by the Linux kernel sometime in 2002.
-A non-standard way to do this is to use a very large number for the
-divisor which isn't really a divisor at all. It's just a code number
-to tell the serial driver what speed to use. In such cases you need
-to compile the kernel with special patches.
+A non-standard way that some manufacturers have implemented high speed
+is to use a very large number for the divisor to get the high speed.
+This number isn't really a divisor at all since it doesn't divide
+anything. It's just serves as a code number to tell the hardware what
+speed to use. In such cases you need to compile the kernel with
+special patches.
-One patch to support this second type of high-speed is called shsmod
-(Super High Speed Mode). There are both Windows and Linux versions of
-this patch. See . There is
-also a module for the VIA VT82C686 chip . Using it may result in buffer
-overflow.
+One patch to support this second type of high-speed hardware is called
+shsmod (Super High Speed Mode). There are both Windows and Linux
+versions of this patch. See . There is also a module for the
+VIA VT82C686 chip . Using it
+may result in buffer overflow.
For internal modems, only a minority of them advertise that they
support speeds of over 115.2k for their built-in serial ports.
@@ -4341,11 +4384,14 @@ response could be due to the modem being in "online data" mode where
it can't accept any AT commands. You may have been using the modem
and then abruptly disconnected (such as killing the process with
signal 9). In that case your modem did not get reset to "command
-mode" where it can interact to AT commands. Thus the message from
-minicom "You are already online. Hangup first." Well, you are sort
-of online but you are may not be connected to anything over the phone
-line. Wvdial will report "modem not responding" for the same
-situation.
+mode" where it can interact to AT commands. "Minicom" may display
+"You are already online. Hangup first." (For another meaning of this
+minicom message see
+[)
+Well, you are sort of online but you are may not be connected to
+anything over the phone line. Wvdial will report "modem not
+responding" for the same situation.
To fix this as a last resort you could reboot the computer. Another
way to try to fix this is to send +++ to the modem to tell it to
@@ -4375,8 +4421,8 @@ error" one may get when trying to use "stty -F /dev/ttySx"). To get a
few of these stty parameters, the true address of the port must be
known to the driver. So the driver may have the wrong address. The
setserial" command will display what the driver thinks but it's likely
-wrong in this case. So what the "modem busy" really means is that the
-serial port (and the modem) can't be found.
+wrong in this case. So what the "modem busy" often means is that the
+serial port (and thus the modem) can't be found.
If you have a pci modem, then use one of these commands: lspci, or cat
/proc/pci, or dmesg to find the correct address and irq of the
@@ -4388,12 +4434,13 @@ the kernel to understand the lspci data correctly. You might notice
this in a boot-time message.
] "You are already online! Hang up first." (from minicom)
+
The modem has its CD signal on. Either you are actually online
(a remote modem is sending you a carrier) or your modem has been setup
to always send the CD signal. In minicom, type at&v to see if
&C or &C0 is set. If so, CD will be on even if you are
-offline and you'll get this error message. The fix is to set &C1
-in the init string or save it in the modem.
+offline and you'll erroneously get this error message. The fix is to
+set &C1 in the init string or save it in the modem.
I can't get near 56k on my 56k modem
There must be very low noise on the line for it to work at even
@@ -4541,6 +4588,9 @@ Nov. '00: which connector is ttyS1, etc. Input/output error, overrun
Dec. '00: /proc/tty/driver/serial shows info, I/O error+, pid 161 in
example n.g.
July '02: typo: is doesn't => it doesn't, clarity re port not found
+Dec. '02: IO error may mean IRQ conflict or IO address conflict.
+Jan. '03: LSR safety check error
+Feb. '03: Interrupts may be shared on PCI Bus
-->
(The following subsections are in both the Serial and Modem HOWTOs)
@@ -4551,20 +4601,22 @@ often because it's disabled and has no address (PnP hasn't enabled it)
or that it is enabled but is not at the I/O address that setserial
thinks it's at. Thus it can't be found.
-Check the BIOS menus and BIOS messages at boot-time. For the PCI bus
-use lspci or scanpci. If it's an ISA bus PnP serial port, try
-"pnpdump --dumpregs" and/or see Plug-and-Play-HOWTO. If the port
-happens to be enabled then the following two paragraphs may help find
-it:
+First check BIOS messages at boot-time (and possible the BIOS menu for
+the serial port). For the PCI bus use lspci or scanpci. If it's an
+ISA bus PnP serial port, try "pnpdump --dumpregs" and/or see
+Plug-and-Play-HOWTO. If the port happens to be enabled then the
+following two paragraphs may help find it:
-Using "scanport" (Debian only ??) will scan all ISA bus ports and may
-discover an unknown port that could be a serial port (but it doesn't
-probe the port). It could hang your PC. You may try probing with
-setserial. See [. If nothing
-seems to get thru the port it may be accessible but have a bad
-interrupt. See ][. Use ]setserial -g to
-see what the serial driver thinks and check for IRQ and I0 address
+For a non-PnP ISA legacy port, using "scanport" (Debian only ??) will
+scan all bus ports and may discover an unknown port that could be a
+serial port (but it doesn't probe the port). It could hang your PC.
+You may try probing with setserial. See [.
+
+If nothing seems to get thru the port it may be accessible but have a
+bad interrupt. See ][. Use ]setserial -g
+to see what the serial driver thinks and check for IRQ and I0 address
conflicts. Even if you see no conflicts the driver may have incorrect
information (view it by "setserial") and conflicts may still exist.
@@ -4717,25 +4769,27 @@ have been automatically removed if it contained a stale process id
"/dev/tty? Device or resource busy"
This means that the device you are trying to access (or use) is
supposedly busy (in use) or that a resource it needs (such as an IRQ)
-is supposedly being used by another device (the resource is "busy").
+is supposedly being used by another device and can't be shared.
This message is easy to understand if it only means that the device is
-busy (in use). But it often means that a resource is in use. What
-makes it even more confusing is that in some cases neither the device
-nor the resources that it needs are actually "busy".
+busy (in use). But it often means that a needed resource is already
+in use (busy). What makes it even more confusing is that in some cases
+neither the device nor the resources that it needs are actually
+"busy".
-The ``resource busy'' part often means (example for
What you need to do is to find the interrupt setserial thinks
- "Input/output error" from setserial or stty
-
You may have typed "ttys" instead of "ttyS". You will see this
-error message if you try to use the setserial command for any device
-that is not a serial port. It also may mean that the serial port is
-in use (busy or opened) and thus the attempt to get/set parameters by
-setserial or stty failed. It could also mean that there isn't any
-serial port at the IO address that setserial thinks your port is at.
+"Input/output error" from setserial, stty, pppd, etc.
+ This means that communication with the serial port isn't working
+right. It could mean that there isn't any serial port at the IO
+address that setserial thinks your port is at. It could also be an
+interrupt conflict (or an IO address conflict). It also may mean that
+the serial port is in use (busy or opened) and thus the attempt to
+get/set parameters by setserial or stty failed. It will also happen
+if you make a typo in the serial port name such as typing "ttys"
+instead of "ttyS".
- Overrun errors on serial port
+"LSR safety check engaged"
+LSR is the name of a hardware register. It's claimed that this
+means there is no serial port at the specified address.
+
+Overrun errors on serial port
This is an overrun of the hardware FIFO buffer and you can't
increase its size. Bug note (reported in 2002): Due to a bug in some
kernel 2.4 versions, the port number may be missing and you will only
@@ -5505,7 +5564,7 @@ system). Such slow (and expensive modems) were later mainly used
for transmitting data between mainframe computers or for connecting a
dumb terminal to a mainframe computer over phone lines. Many dumb
terminals didn't even have a screen display, but printed on paper
-instead.
+what you typed at the keyboard along with responses from the computer.
PCs and BBSs
With the advent of the personal computer (PCs) in the early 1980s,
@@ -5513,12 +5572,15 @@ the PC was used like a dumb terminal for connecting to mainframes.
But now files could be transferred and one PC could connect to
another.
-The 1980s saw the rise of the Bulletin Board System (BBS). The public
+The 1980s saw the rise of the Bulletin Board System (BBS). This was
+just a computer with a modem listening for incoming calls. The public
could dial up a BBS with a modem and then downloadable free software,
participate in discussions on various topics, play on-line games, etc.
-It was something like visiting a large Internet site. Many BBSs would
-have a monthly charge but some were run by volunteers and were free.
-Many companies established BBSs for customers that contained support
+Dialing in to a BBS was something like an Internet site. Except that
+to go to another BBS site, you would need to dial another number (and
+possible pay long distance telephone charges). Many BBSs would have a
+monthly charge but some were run by volunteers and were free. Many
+companies established BBSs for customers that contained support
information, catalogs, etc. In the early 1990s, BBSs were booming.
By the mid 1990s some even offered Internet connections. For some
history of BBSs see David S.Lawyer
original by Greg Hankins
- v2.16 March 2002
+ v2.17 February 2003
+
Please freely copy and distribute (sell or give away) this document
in any format. Send any corrections and comments to the document
@@ -91,7 +93,7 @@ provided that you:
- If it's not a translation: Email a copy of your derivative work
(in a format LDP accepts) to the author(s) and maintainer (could be
the same person). If you don't get a response then email the LDP
- (Linux Documentation Project): submit@linuxdoc.org.
+ (Linux Documentation Project): submit@en.tldp.org.
- License the derivative work in the spirit of this license or use
GPL. Include a copyright notice and at least a pointer to the
license used.
@@ -109,9 +111,9 @@ them. Since this is free documentation, it should be obvious that I
cannot be held legally responsible for any errors.
Trademarks.
- Any brand names (starts with a capital letter) should be assumed to
-be a trademark). Such trademarks belong to their respective owners.
-
+
Any brand names (starts with a capital letter such as MS Windows)
+should be assumed to be a trademark). Such trademarks belong to their
+respective owners.
Credits
@@ -128,20 +130,22 @@ half is by David Lawyer. Ted Ts'o has continued to be helpful.
New Versions of this Serial-HOWTO
New versions of the Serial-HOWTO will be available to
browse and/or download at LDP mirror sites. For a list of mirror
-sites see: .
+sites see: .
Various formats are available. If you only want to quickly check the
date of the latest version look at and compare
-it to this version: v2.16 March 2002 . New in recent versions:
-v2.16 March 2002 fixed a few broken links.
-v2.15 November 2001: mention of MIDI ports, problems with lockfiles
- for devfs
-v2.14 August 2001: major revision of Configuring the Serial Port
-v2.13 August 2001: fixed typos: done->down and "is is", USRT chip,
- synchronous defined better
-v2.12 July 2001: serial printing under LPRng
-v2.11 May 2001: stty 0 => hangup (was ok in v2.08. )
-v2.10 EIA-485, frame errors on networks, gkermit, firewire
+url="http://www.tldp.org/HOWTO/Serial-HOWTO.html"> and compare
+it to this version: v2.17 February 2003 .
+
+New in Recent Versions
+ For a full revision history going back to the time I started
+maintaining this HOWTO, see the source file (in linuxdoc format) at
+.
+
+v2.18 January 2003: url signum->cendio,
+v2.17 June 2002: Mac port names, clarity when stopping data flow when
+printing, ide2 address conflict
+v2.16 March 2002 fixed a few broken links
Related HOWTO's re the Serial Port
Modems, Text-Terminals, some printers, and other peripherals often
@@ -162,6 +166,8 @@ explained above.
configure, and repair them. It includes a section on "Make a
Terminal the Console" which is useful for using a remote terminal to
control a server (via the serial port).
+Remote-Serial-Console-HOWTO is about making a
+ text-terminal be the console so it can display boot-time messages, etc.
Feedback
@@ -176,9 +182,9 @@ Lawyer)
.
What is a Serial Port?
The conventional serial port (not the newer USB port, or HSSI
port) is a very old I/O port. Almost all PC's have them. But Macs
-(Apple Computer) after mid 1998 (with colored cases) only have the USB
-port. It's possible, however, to put a conventional serial port
-device on the USB.
+(Apple Computer) after mid-1998 only have the USB port. It's
+possible, however, to put a conventional serial port device on the
+USB but the ports are expensive.
The common specification for the conventional serial port is RS-232
(or EIA-232). The connector for the serial port is often seen as one
@@ -355,6 +361,7 @@ Sept. '00: data flow diagram
Dec. '00 flow control +
July '01 done -> down
Feb. '02 4k buffer -> 8k
+Feb '03: UARTs with auto flow control. Rewrite of Flow Control.
-->
@@ -367,7 +374,7 @@ name="How the Hardware Transfers Bytes"> but in greater detail.
What is a Serial Port ?
Intro to Serial
- The serial port is an I/O (Input/Output) device.
+
The UART serial port (or just "serial port for short" is an I/O (Input/Output) device.
An I/O device is just a way to get data into and out of a computer.
@@ -478,7 +485,7 @@ which ttyS. This mapping of names (such as ttyS1) to I/O addresses
(and IRQ's) may be both set and viewed by the "setserial" command.
See [. This does
] for more details>
When the serial port receives a number of bytes (may be set to 1, 4,
8, or 14) into its FIFO buffer, it signals the CPU to fetch them by
sending an electrical signal known as an interrupt on a certain wire
-normally used only by that port. Thus the FIFO waits for a number of
-bytes and then issues an interrupt.
+normally used only by that port. Thus the FIFO waits until it has
+received a number of bytes and then issues an interrupt.
However, this interrupt will also be sent if there is an unexpected
delay while waiting for the next byte to arrive (known as a timeout).
-Thus if the bytes are being received slowly (such as someone typing on
-a terminal keyboard) there may be an interrupt issued for every byte
-received. For some UART chips the rule is like this: If 4 bytes in a
-row could have been received, but none of these 4 show up, then the
-port gives up waiting for more bytes and issues an interrupt to fetch
-the bytes currently in the FIFO. Of course, if the FIFO is empty,
-no interrupt will be issued.
+Thus if the bytes are being received slowly (such as from someone
+typing on a terminal keyboard) there may be an interrupt issued for
+every byte received. For some UART chips the rule is like this: If 4
+bytes in a row could have been received in an interval of time, but
+none of these 4 show up, then the port gives up waiting for more bytes
+and issues an interrupt to fetch the bytes currently in the FIFO. Of
+course, if the FIFO is empty, no interrupt will be issued.
Each interrupt conductor (inside the computer) has a number (IRQ) and
the serial port must know which conductor to use to signal on. For
@@ -511,19 +518,20 @@ list of them and more will be found in "man setserial" (search for
"Configuring Serial Ports"). Interrupts are issued whenever the
serial port needs to get the CPU's attention. It's important to do
this in a timely manner since the buffer inside the serial port can
-hold only 16 (1 in old serial ports) incoming bytes. If the CPU fails
-to remove such received bytes promptly, then there will not be any
-space left for any more incoming bytes and the small buffer may
-overflow (overrun) resulting in a loss of data bytes.
+hold only 16 incoming bytes. If the CPU fails to remove such received
+bytes promptly, then there will not be any space left for any more
+incoming bytes and the small buffer may overflow (overrun) resulting
+in a loss of data bytes.
+
There is no [ to prevent
this.
Interrupts are also issued when the serial port has just sent out all
-16 of its bytes from its small transmit buffer out the external cable.
+of its bytes from its small transmit buffer out the external cable.
It then has space for 16 more outgoing bytes. The interrupt is to
notify the CPU of that fact so that it may put more bytes in the small
transmit buffer to be transmitted. Also, when a modem control line
-changes state an interrupt is issued.
+changes state, an interrupt is issued.
The buffers mentioned above are all hardware buffers. The serial port
also has large buffers in main memory. This will be explained later
@@ -567,7 +575,7 @@ be reduced.
] Flow control means the ability to slow down the flow of bytes in a
wire. For serial ports this means the ability to stop and then
restart the flow without any loss of bytes. Flow control is needed
-for modems to allow a jump in instantaneous flow rates.
+for modems and other hardware to allow a jump in instantaneous flow rates.
Example of Flow Control
For example, consider the case where you connect a 33.6k external
@@ -602,18 +610,19 @@ which is already compressed and can't be compressed further. Now
let's consider the opposite extreme where the modem is compressing the
data with a high compression ratio. In such a case the modem might
need an input flow rate of say 115.2k bps to provide an output (to the
-phone line) of 33.6k bps (compressed data). The compression ratio is
-3.43 (115.2/33.6) which is much higher than average. In this case the
-modem is able to compress and the 115.2 bps PC-to-modem flow and send
-the same data out on the phone line at 33.6bps. There's no need for
-flow control here. But such a high compression ratio rarely happens
-so that most of the time flow control is needed to slow down the flow
-on the 115.2 bps PC-to-modem cable. The flow is stopped and started
-so that the average flow is usually well under the "on" flow of 115.2
-bps.
+phone line) of 33.6k bps (compressed data). This compression ratio is
+3.43 (115.2/33.6). In this case the modem is able to compress and
+the 115.2 bps PC-to-modem flow and send the same data (in compressed
+form) out the phone line at 33.6bps. There's no need for flow control
+here so long as the compression ratio remains higher that 3.43. But
+the compression ratio varies from second to second and is likely to
+drops below 3.43. Thus, some of the time flow control is needed to
+slow down the average flow on the 115.2 bps PC-to-modem cable. The
+flow is stopped and started so that the average flow is usually lower
+than the "on" flow of 115.2 bps.
In the above example the modem was an external modem. But the same
-situation exists (as of late 2000) for most internal modems. There is
+situation exists (as of early 2003) for most internal modems. There is
still a speed limit on the PC-to-modem speed even though this flow
doesn't take place over an external cable. This makes the internal
modems compatible with the external modems.
@@ -623,13 +632,17 @@ a modem. But there is also flow control which is used for the
opposite direction of flow: from a modem (or other device) to a
computer. Each direction of flow involve 3 buffers: 1. in the modem
2. in the UART chip (called FIFOs) 3. in main memory managed by the
-serial driver. Flow control protects certain buffers from
-overflowing. The small UART FIFO buffers are not protected in this
-way but rely instead on a fast response to the interrupts they issue.
-FIFO stand for "First In, First Out" which is the way it handles
-bytes. All the 3 buffers use the FIFO rule but only one of them also
-uses it as a name. This is the essence of flow control but there are
-still some more details.
+serial driver. Flow control protects all buffers (except the FIFOs)
+from overflowing.
+
+Under Linux, the small UART FIFO buffers are not protected in this way
+but rely instead on a fast response to the interrupts they issue.
+Some UART chips can be set to do hardware flow control to protect
+their FIFOs but Linux (as of early 2003) doesn't seem to support it.
+FIFO stand for "First In, First Out" which is the way it handles bytes
+in a queue. All the 3 buffers use the FIFO rule but only one of them
+is named "FIFO". This is the essence of flow control but there
+are still some more details.
@@ -646,8 +659,24 @@ 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.
+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 date 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 the signal.
+For the case of a modem this "other" pin will be the modem's RTS pin
+(same pin label as the PC). But for a printer or terminal, it will be
+a CTS pin and requires "crossover" or "null modem" cable so as to
+connect the CTS pin at one end with the RTS pin at the other end. 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 and the RTS pin a receive it. For a
+non-modem, the roles of the RTS and CTS pins are interchanged.
Software flow control uses the main receive and transmit wires to send
the start and stop signals. It uses the ASCII control characters DC1
@@ -661,50 +690,53 @@ code. Likewise for DC1.
Data Flow Path; Buffers
- Much has been explained about this including flow
-control, a pair of 16-byte FIFO buffers (in the UART), and a pair of
-larger buffers inside a device connected to the serial port (such as a
-modem. But there is still another pair of buffers. These are large
-buffers (perhaps 4k) in main memory also known as serial port buffers.
-When an application program sends bytes to the serial port
-
-they first get stashed in the the transmit serial port buffer in main
-memory. The pair consists of both this transmit buffer and 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.
+
It's been mention 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
+pair consists of both the transmit buffer and 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 4k-byte 16-byte 1k-byte tele-
-BROWSER ------- MEMORY -------- UART --------- MODEM -------- phone
+application 8k-byte 16-byte 1k-byte tele-
+BROWSER ------- MEMORY -------- FIFO --------- MODEM -------- phone
program buffer buffer buffer line
-The serial device driver takes out say 16 bytes from this transmit buffer,
-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
-transmitted to the modem or other device connected to the serial port
-which also has a fair sized (say 1k) buffer. When the device driver
-(on orders from flow control) stops the flow of outgoing bytes from
-the computer, what it actually stops is the flow of outgoing bytes
-from the large transmit buffer in main memory. Even after this has
-happened and the flow to the device
-connected to the serial port has stopped, an application program
-may keep sending bytes to the 4k transmit buffer until it becomes
-fill.
+For the transmit case, the serial device driver takes out say 16 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 transmitted to the
+modem or (other device connected to the serial port) which also has a
+fair sized (say 1k) buffer. When the device driver (on orders from
+flow control) stops the flow of outgoing bytes from the computer, what
+it actually stops is the flow of outgoing bytes from the large
+transmit buffer in main memory. Even after this has happened and the
+flow to the modem has stopped, an application program may keep sending
+bytes to the 8k transmit buffer until it becomes fill. At the same
+time, the bytes stored in the FIFO and MODEM continue to be sent out
+until these buffers empty.
-When it gets fill, the application program can't send any more bytes
-to it (a "write" statement in a C_program blocks) and the application
-program temporarily stops running and waits until some buffer space
-becomes available. Thus a flow control "stop" is ultimately able to
-stop the program that is sending the bytes. Even though this program
-stops, the computer does not necessarily stop computing. It may
-switch to running other processes while it's waiting at a flow control
-stop. The above was a little oversimplified since there is another
-alternative of having the application program itself do something else
-while it is waiting to "write".
+When the memory buffer gets fill, the application program can't send
+any more bytes to it (a "write" statement in a C_program blocks) and
+the application program temporarily stops running and waits until some
+buffer space becomes available. Thus a flow control "stop" is
+ultimately able to stop the program that is sending the bytes. Even
+though this program stops, the computer does not necessarily stop
+computing since it may switch to running other processes while it's
+waiting at a flow control stop.
+
+The above was a little oversimplified in two ways. First, some UARTs
+can do automatic hardware flow control which can stop the transmission
+out of the FIFO buffers if needed (not yet supported by Linux).
+Second, while an application process is waiting to write to the
+transmit buffer, it could possibly perform other tasks.
@@ -712,17 +744,18 @@ while it is waiting to "write".
Complex Flow Control Example
For many situations, there is a transmit path involving several
links, each with its own flow control. For example, I type at a
-text-terminal connected to a PC with a modem to access a BBS. For
-this I use the application program "minicom" which deals with 2 serial
-ports: one connected to a modem and another connected to the
-text-terminal. What I type at the text terminal goes into the first
-serial port to minicom, then from minicom out the second serial port
-to the modem, and then onto the telephone line to the BBS. The
-text-terminal has a limit to the speed at which bytes can be displayed
-on its screen and issues a flow control "stop" from time to time to
-slow down the flow. What happens when such a "stop" is issued? Let's
-consider a case where the "stop" is long enough to get thru to the BBS
-and stop the program at the BBS which is sending out the bytes.
+text-terminal connected to a PC with a modem to access a BBS (Bulletin
+Board System). For this I use the application program "minicom" which
+deals with 2 serial ports: one connected to a modem and another
+connected to the text-terminal. What I type at the text terminal goes
+into the first serial port to minicom, then from minicom out the
+second serial port to the modem, and then onto the telephone line to
+the BBS. The text-terminal has a limit to the speed at which bytes
+can be displayed on its screen and issues a flow control "stop" from
+time to time to slow down the flow. What happens when such a "stop"
+is issued? Let's consider a case where the "stop" is long enough to
+get thru to the BBS and stop the program at the BBS which is sending
+out the bytes.
Let's trace out the flow of this "stop" (which may be "hardware" on
some links and "software" on others). First, suppose I'm "capturing"
@@ -730,15 +763,15 @@ a long file from the BBS which is being sent simultaneously to both my
text-terminal and a to file on my hard-disk. The bytes are coming in
faster than the terminal can handle them so it sends a "stop" out its
serial port to the first serial port on my PC. The device driver
-detects it and stops sending bytes from the 4k serial buffer (in main
+detects it and stops sending bytes from the 8k serial buffer (in main
memory) to the terminal. Now minicom still keeps sending out bytes for
-the terminal into this 4k buffer.
+the terminal into this 8k buffer.
-When this 4k transmit buffer (on the first serial port) is full,
+When this 8k transmit buffer (on the first serial port) is full,
minicom must stop writing to it. Minicom stops and waits. But this
-also causes minicom to stop reading from the 4k receive buffer on the
+also causes minicom to stop reading from the 8k receive buffer on the
2nd serial port connected to the modem. Flow from the modem continues
-until this 4k buffer too fills up and sends a different "stop" to the
+until this 8k buffer too fills up and sends a different "stop" to the
modem. Now the modem's buffer ceases to send to the serial port and
also fills up. The modem (assuming error correction is enabled) sends
a "stop signal" to the other modem at the BBS. This modem stops
@@ -747,11 +780,11 @@ stop signal is sent to the serial port of the BBS. At the BBS, the
8-k (or whatever) buffer fills up and the program at the BBS can't
write to it anymore and thus temporarily halts.
-Thus a stop signal from a text terminal has halted a programs on a BBS
+Thus a stop signal from a text terminal has halted a program on a BBS
computer. What a complex sequence of events! Note that the stop
signal passed thru 4 serial ports, 2 modems, and one application
program (minicom). Each serial port has 2 buffers (in one direction
-of flow): the 4k one and the hardware 16-byte one. The application
+of flow): the 8k one and the hardware 16-byte one. The application
program may have a buffer in its C_code. This adds up to 11 different
buffers the data is passing thru. Note that the small serial hardware
buffers do not participate directly in flow control.
@@ -790,7 +823,7 @@ happened there, bytes intended for the hard-disk were lost.
Serial Driver Module
The device driver for the serial port is the software that
operates the serial port. It is now provided as a serial module.
->From kernel 2.2 on, this module will normally get loaded automatically
+From kernel 2.2 on, this module will normally get loaded automatically
if it's needed. In earlier kernels, you had to have
- Moxa C104, Moxa C104+ (AST FourPort compatible) *
by National Instruments
+- NetBus (2 ports)
using patch from
+
- PC-COMM (4 ports)
COMM-2 (2 ports), COMM-4 (4 ports) and COMM-8 (8 ports)
@@ -1152,14 +1187,14 @@ driver status: for 2.2 kernel. Supported by Chase.
- Decision PCCOM (2-8 ports; ISA and PCI; aka PC COM)
ISA:
contact:
- driver location: (dead link)
+ driver location: (dead link)
PCI:
drivers:
driver status: Support in serial driver 5.03. For an earlier driver,
there exists a patch for kernel 2.2.16 at and for kernels 2.2.14-2.2.17
- at
+ at
- Digi PC/Xi (12.5MHz 80186; 4, 8, or 16 ports),
PC/Xe (12.5/16MHz 80186; 2, 4, or 8 ports),
@@ -1316,6 +1351,9 @@ See the section [
Change-log:
Aug. 2001: removed mention of patch to convert Linux to a PnP OS;
better explanation of PCI
+July 2001: Improve PCI part. Remove "card" since serial ports are
+often built into the motherboard.
+Feb. 2003: Removed request to send info to Ted Tso.
-->
] IO & IRQ Overview
@@ -1328,24 +1366,33 @@ a serial port card. Today it's set by digital signals sent to the
hardware and this is part of "Plug-and-Play (PnP).
The driver must also know both the IO address and IRQ so that it can
-locate the card. Modern drivers (kernel 2.4) determine this by PnP
-methods so one doesn't need to tell them (by using "setserial"). The
-driver uses PnP functions provided by Linux to determine what the IO
-and IRQ are and to set them if necessary. The driver also probes
-possible serial port addresses to see if there are any serial ports
-there. This works for the case of jumpers and sometimes works for a
-PnP port when the driver doesn't do PnP.
+locate the port chip. Modern serial port drivers (kernel 2.4) try to
+determine this by PnP methods so one doesn't need to tell them (by
+using "setserial"). Such a driver might also set an IO address or
+enable the hardware. But unfortunately, there is some PCI serial port
+hardware that the driver doesn't recognize so you may need to enable
+the port yourself. See [
+
+The driver also probes possible ISA serial port addresses to see if
+there are any serial ports there. This works for the case of jumpers
+and sometimes works for a PnP port when the driver doesn't do PnP
+(prior to kernel 2.4).
Locating the serial port by giving it an IRQ and IO address is
-low-level configuring. What follows repeats what was said above in
-more detail. This low-level configuring consists of assigning an IO
-address, IRQ, and name (such as ttyS2). This IO-IRQ pair must be set
-in both the hardware and told to the serial driver. We could call
-this "io-irq" configuring for short. The "setserial" program is one
-way to tell the driver. The other way is for the driver to use PnP
-methods to determine/set the IO/IRQ and then remember what it did.
-For jumpers you must always use "setserial". If you need to configure
-but don't understand certain details it's easy to get into trouble.
+low-level configuring. It's often automatically done by the serial
+driver but sometimes you have to do it yourself. What follows repeats
+what was said above but in more detail.
+
+The low-level configuring consists of assigning an IO address, IRQ,
+and name (such as ttyS2). This IO-IRQ pair must be set in both the
+hardware and told to the serial driver. Only the driver needs to know
+the name.We could call this "io-irq" configuring for short. The
+"setserial" program is one way to tell the driver. The other way is
+for the driver to use PnP methods to determine/set the IO/IRQ and then
+remember what it did. For jumpers you must always use "setserial".
+If you need to configure but don't understand certain details it's
+easy to get into trouble.
When Linux starts, some effort is made to detect and configure
(low-level) a few serial ports. Exactly what happens depends on your
@@ -1363,25 +1410,25 @@ then you need to do it if you:
For kernel 2.2+ you may be able to use more that 2 serial ports
without doing any low-level configuring by sharing interrupts. All
-PCI cards should support this but for ISA it only works for some
+PCI ports should support this but for ISA it only works for some
hardware. It may be just as easy to give each port a unique interrupt
if they is available. See ][
The low-level configuring (setting the IRQ and IO address) seems to
-cause people more trouble than the high-level, although for many it's
-fully automatic and there is no configuring to be done. Until the
-serial driver knows the correct IRQ and IO address, the port will not
-usually not work at all. Also, PnP ports can be disabled so that they
-can't be found (except with PnP tools). Applications, and utilities
-such as "setserial" and "scanport" don't use PnP tools and thus can't
-detect disabled ports. For example, an IO enabling bit must be set in
-PCI serial port hardware by PnP so that it's IO address may be used.
+cause people more trouble than the high-level stuff, although for many
+it's fully automatic and there is no configuring to be done. Until
+the serial driver knows the correct IRQ and IO address, the port will
+not usually not work at all. Also, PnP ports can be disabled so that
+they can't be found (except with PnP tools such as lspci).
+Applications, and utilities such as "setserial" and "scanport" (Debian
+only ??) don't use PnP tools and thus can't detect
+disabled ports.
-Even if the port can be found by normal (non-PnP) software, it may
-work extremely slow if the IRQ is wrong. See ][.
+delays">. PCI ports are less likely to get the IRQ wrong.
In the Wintel world, the IO address and IRQ are called "resources" and
we are thus configuring certain resources. But there are many other
@@ -1393,32 +1440,33 @@ address) into two places:
]
- the device driver (often by running "
memory registers of the serial port hardware itself
+- configuration registers of the serial port hardware itself
You may watch the start-up (= boot-time) messages. They are usually
-correct. But if you're having problems, there's a good chance that
-the ones that look like "setserial" output don't show the true
-configuration of the hardware (and they are not necessarily supposed
-to). See [.
+correct. But if you're having problems, your serial port may not show
+up at all or if you do see a message from "setserial" it may not
+show the true configuration of the hardware (and it is not necessarily
+supposed to). See ][.
] PCI Bus Support
+Introduction
If you have kernel 2.4, then there should be support for PnP (either
-built-in or by modules). Some PCI serial cards can be automatically
-detected and low-level configured by the serial driver. Others will
+built-in or by modules). Some PCI serial ports can be automatically
+detected and low-level configured by the serial driver. Others may
not be.
Kernel 2.2 had no support for PCI serial ports (although some people
got them working anyway). The 2.4 serial driver will read the id
-number digitally stored on the serial hardware to determine how to
-support it (if it knows how). It should assign the I/O address to it,
-determine it's IRQ, etc. So you don't need to use "setserial" for it
-??
-
-If you have a
+number digitally stored in the serial hardware to determine how to
+support it (if it knows how). It should assign an I/O address to it,
+determine it's IRQ, etc. So you don't need to use "setserial" for it.
+
+More info on PCI
+PCI ports are not well standardized. Some use main memory for
communication with the PC. Some require special enabling of the IRQ.
The output of "lspci -vv" can help determine if one can be supported.
If you see a 4-digit IO port, the port might work by just telling
@@ -1620,9 +1669,9 @@ view it.
by PnP methods. Even if nothing has been set or the port disabled,
PnP ports may still be found by using "lspci -v" or "isapnp
--dumpregs". Ports disabled by jumpers (or hardware failures) are
-lost. See [,
+completely lost. See ][,
][,
-][
+][
PnP ports don't store their configuration in the hardware when the
power is turned off. This is in contrast to Jumpers (non-PnP) which
@@ -1633,29 +1682,48 @@ likely to be found in a disabled state than an old non-PnP one.
] For PCI, the BIOS almost always sets the IRQ and may set the IO
address as well. To see how it's set use "lspci -vv" (best) or look
in /proc/bus/pci (or for kernels <2.2 /proc/pci). The modem's
-serial port is often called a "Communication controller". If more
-than one IO address is shown, the first one is more likely to be it.
-You can't change the IRQ (at least not with "setpci") This is
-because if one writes it in it's hardware register no action is taken
-on it. It's the BIOS that should actually set up the IRQs and then
-write the correct value to this register for lspci to view. If you
-must, change the IO address with "setpci" by changing the
-BASE_ADDRESS_0 or the like. The _0 (or _1) after BASE_ADDRESS must be
-the correct register.
+serial port is often called a "Communication controller". Look for
+this. If lspci shows "I/O ports at ... [disabled]" then the serial
+port is disabled and the hardware has no IO address so it's lost and
+can't be used. See [ for how to enable it.
-] PCI: Is the port enabled?
-If the port communicates via an IO address "then lspci -vv" should
+If more than one IO address is shown, the first one is more likely to
+be it. You can't change the IRQ (at least not with "setpci") This
+is because if one writes an IRQ it it's hardware register no action is
+taken on it. It's the BIOS that should actually set up the IRQs and
+then write the correct value to this register for lspci to view. If
+you must, change the IO address with "setpci" by changing the
+BASE_ADDRESS_0 or the like.
+
+ PCI: Enabling a disabled port
+If the port communicates via an IO address then "lspci -vv" should
show "Control: I/O+ ..." with + meaning that the IO address is
-enabled. If it shows "I/O-" then you may need to use the setpci
-command to enable it. For example "setpci -d 151f:000 command=101".
-The "command" means the command register which is the same as the
-"Control" register displayed by lspci. The 101h sets two bits: the 1
-sets I/O to + and the 100 part keeps SERR# set to +. In this case
-only the SERR# bit of the Control register was initially observed to
-be + when the lspci command was run. So we kept it enabled to + by
-setting bit 8 (where bit 0 is I/O) to 1 by the first 1 in 101. My
-apologies if setting bits is confusing. Bit 8 is actually the 9th bit
-since we started counting bits from 0.
+enabled. If it shows "I/O-" (and "I/O ports at ... [disabled]") then
+you may need to use the setpci command to enable it. For example
+"setpci -d 151f:000 command=101". 151f is the vendor id, and 000 is
+the device id both obtained from "lspci -n -v" or from /proc/bus/pci
+or from "scanpci -v". The "command=101" means that 101 is put into
+the command register which is the same as the "Control" register
+displayed by "lspci". The 101h sets two bits: the 1 sets I/O to + and
+the 100 part keeps SERR# set to +. In this case only the SERR# bit
+of the Control register was initially observed to be + when the lspci
+command was run. So we kept it enabled to + by setting bit 8 (where
+bit 0 is I/O) to 1 by the first 1 in 101. Some serial cards don't use
+SERR# so if you see SERR#- then there's no need to enable it so then
+use: command=1. Then you'll need to set up "setserial" to tell the
+driver the IO and IRQ.
+
+Bit 8 is actually the 9th bit since we started counting bits from 0.
+Don't be alarmed that lspci shows a lot of - signs showing that the
+card doesn't have many features available (or enabled). Serial ports
+are relatively slow and don't need these features.
+
+Another way to enable it is to let the BIOS do it by telling the BIOS
+that you don't have a plug-and-play operating system. Then the BIOS
+should enable it when you start your PC. If you have MS Windows9x on
+the same PC then doing this might cause problems with Windows (see
+Plug-and-Play-HOWTO).
ISA PnP ports
For an ISA Plug-and-Play (PnP) port one may try the .
+Using "scanport" (Debian only ??) will probe all I/O ports and will
+indicate what it thinks may be serial port. After this you could try
+probing with setserial using the "autoconfig" option. You'll need to
+guess the addresses to probe at (using clues from "scanport"). See
+[.
For a port set with jumpers, the IO ports and IRQs are set per the
jumpers. If the port is not Plug-and-Play (PnP) but has been setup by
@@ -1977,6 +2046,7 @@ interface and makes it easy to deal with a huge number of devices.
The device names have all changed as well. But there's an option to
continue using the old names. For a detailed description of it see:
]
+Also see the kernel documentation tree: filesystems/devfs.
The name changes (if used) are: ttyS2 becomes tts/2 (Serial port),
tty3 becomes vc/3 (Virtual Console), ptyp1 becomes pty/m1 (PTY
@@ -1993,26 +2063,26 @@ in the /dev directory.
There formerly was a "cua" name for each serial port and it behaved
just a little differently. For example, ttyS2 would correspond to
-cua2. The cua major number was 5 and minor numbers started at 64.
-You may still have the cua devices in your /dev directory but they are
-now deprecated. Their drivers behave slightly different than for the
-ttyS ones. name="cua Device Obsolete">."') See the Modem-HOWTO section: "cua Device
- Obsolete">.
+cua2. It was mainly used for modems. The cua major number was 5 and
+minor numbers started at 64. You may still have the cua devices in
+your /dev directory but they are now deprecated. For details see
+Modem-HOWTO, section: cua Device Obsolete.
Dos/Windows use the COM name while the
+
ISA IO devfs usb
dos major minor address devfs devfs usb acm modem
COM1 /dev/ttyS0 4, 64; 3F8 /dev/tts/0 /dev/usb/tts/0 /dev/usb/acm/0
COM2 /dev/ttyS1 4, 65; 2F8 /dev/tts/1 /dev/usb/tts/1 /dev/usb/acm/1
COM3 /dev/ttyS2 4, 66; 3E8 /dev/tts/2 /dev/usb/tts/2 /dev/usb/acm/2
COM4 /dev/ttyS3 4, 67; 2E8 /dev/tts/3 /dev/usb/tts/3 /dev/usb/acm/3
-
+
USB (Universal Serial Bus) Ports
The serial ports on the USB are: /dev/ttyUSB0, /dev/ttyUSB1, etc.
@@ -2181,6 +2251,7 @@ May 2000: IRQs near end ttyS0 -> ttyS1 + clarity
Nov. 2000: auto_irq may work on the 2nd try
Dec. 2000: saving state of serial module
June 2001 OK to use setserial with Laptops
+Nov. 2002 Debian's /var/lib/serial.conf
-->
This part is in 3 HOWTOs: Modem, Serial, and Text-Terminal. There
are some minor differences, depending on which HOWTO it appears in.
@@ -2266,14 +2337,15 @@ port address, any IRQ, and whatever uart type you would like to have.
Then the next time you type "setserial ..." it will display these
bogus values without complaint. They will also be officially
registered with the kernel as displayed (at the top of the screen) by
-the "scanport" command. Of course the serial port driver will not
-work correctly (if at all) if you attempt to use such a port. Thus
-when giving parameters to "setserial" anything goes. Well almost. If
-you assign one port a base address that is already assigned (such as
-3e8) it will not accept it. But if you use 3e9 it will accept it.
-Unfortunately 3e9 is already assigned since it is within the range
-starting at base address 3e8. Thus the moral of the story is to make
-sure your data is correct before assigning resources with setserial.
+the "scanport" command (Debian). Of course the serial
+port driver will not work correctly (if at all) if you attempt to use
+such a port. Thus when giving parameters to "setserial" anything
+goes. Well almost. If you assign one port a base address that is
+already assigned (such as 3e8) it may not accept it. But if you use
+3e9 it will accept it. Unfortunately 3e9 is already assigned since it
+is within the range starting at base address 3e8. Thus the moral of
+the story is to make sure your data is correct before assigning
+resources with setserial.
While assignments made by setserial are lost when the PC is powered
off, a configuration file may restore them (or a previous
@@ -2287,10 +2359,11 @@ name="Configuration Scripts/Files">
Probing
Prior to probing with "setserial", one may run the "scanport"
-command to check all possible ports in one scan. It makes crude
-guesses as to what is on some ports but doesn't determine the IRQ. But
-it's a fast first start. It may hang your PC but so far it's worked
-fine for me.
+(Debian) command to check all possible ports in one scan. It makes
+crude guesses as to what is on some ports but doesn't determine the
+IRQ. But it's a fast first start. It may hang your PC but so far
+it's worked fine for me. Note that non-Debian distributions don't
+seem to supply "scanport". Is there an another scan program?
With appropriate options, = 2.15, the results of your
last probe test could be automatically saved and put into the
-configuration file /etc/serial.conf which will be used next
-time you start Linux. At boot-time when the serial module loads (or
-the like), a probe for UARTs is made automatically and reported on the
-screen. But the IRQs shown may be wrong. The second report of the
-same is the result of a script which usually does no probing and thus
-provides no reliable information as to how the hardware is actually
-set. It only shows configuration data someone wrote into the script
-or data that got saved in /etc/serial.conf.
+configuration file /etc/serial.conf or
+/var/lib/serial.conf which will be used next time you start
+Linux. At boot-time when the serial module loads (or the like), a
+probe for UARTs is made automatically and reported on the screen. But
+the IRQs shown may be wrong. The second report of the same is the
+result of a script which usually does no probing and thus provides no
+reliable information as to how the hardware is actually set. It only
+shows configuration data someone wrote into the script or data that
+got saved in /etc/serial.conf.
It may be that two serial ports both have the same IO address set in
the hardware. Of course this is not permitted but it sometimes
@@ -2652,7 +2726,7 @@ way to stop the hang.
One way to try to get out of the above hang is to use the newer -F
option and set "clocal" and/or "crtscts" as needed. If you don't have
-the -F option then you may try to run some program (such a minicom) on
+the -F option then you may try to run some program (such as minicom) on
the port that will force it to operate even if the control lines say
not to. Then hopefully this program might set the port so it doesn't
need the control signal in the future in order to open: clocal or
@@ -2768,6 +2842,7 @@ uses the serial port. See [
] Can't Set a High Enough Speed
Speeds over 115.2k
The top speed of 115.2k has been standard since the mid 1990's.
@@ -2776,23 +2851,30 @@ But by the year 2000, most new serial ports supported higher speeds of
seldom uses these speeds due to lack of drivers. Thus such ports
behave just like 115.2k ports unless the higher speeds are enabled by
special software. To get these speeds you need to compile the kernel
-with special patches but it seems that the 2.4 kernels are not yet
-supported
+with special patches until support is built into the kernel's serial
+driver.
-The patch software is fairly simple since it only needs to enable the
-higher speeds by dialog with the hardware. But it's not quite as
-simple as just putting an enable byte in a hardware register since the
-registers weren't designed for this. But unfortunately, there is no
-standard way to enable the higher speeds so the serial driver needs to
-support a variety of hardware.
+Unfortunately serial port manufacturers never got together on a
+standard way to support high speeds, so the serial driver needs to
+support a variety of hardware. Once high speed is enabled, a standard
+way to choose it is to set baud_base to the highest speed with
+setserial (unless the serial driver does this for you). The software
+will then use a divisor of 1 to set the highest speed. All this will
+hopefully be supported by the Linux kernel sometime in 2002.
-A patch to support high-speed is called shsmod (Super High Speed
-Mode). There are both Windows and Linux versions of this patch. See
-. For Linux (as of late
-2001), most of the documentation is only in Japanese and the patch is
-for the old kernel 2.2.x. There is also a module for the VIA
-VT82C686 chip . Using it may
-result in buffer overflow.
+A non-standard way that some manufacturers have implemented high speed
+is to use a very large number for the divisor to get the high speed.
+This number isn't really a divisor at all since it doesn't divide
+anything. It's just serves as a code number to tell the hardware what
+speed to use. In such cases you need to compile the kernel with
+special patches.
+
+One patch to support this second type of high-speed hardware is called
+shsmod (Super High Speed Mode). There are both Windows and Linux
+versions of this patch. See . There is also a module for the
+VIA VT82C686 chip . Using it
+may result in buffer overflow.
For internal modems, only a minority of them advertise that they
support speeds of over 115.2k for their built-in serial ports.
@@ -2801,7 +2883,7 @@ Does shsmod support these ??
How speed is set in hardware: the divisor and baud_base
Speed is set by having the serial port's clock change frequency.
-But this change happens not by acutally changing the frequency of the
+But this change happens not by actually changing the frequency of the
oscillator driving the clock but by "dividing" the clock's frequency.
For example, to divide by two, just ignore every other clock tick.
This cuts the speed in half. Dividing by 3 makes the clock run at 1/3
@@ -3086,23 +3168,28 @@ specialty item and are expensive if purchased new.
Stopping the Data Flow when Printing, etc.
Normally flow control and/or application programs stop the flow of
-bytes when its needed. But sometimes they don't. One example is
-printing to printer on the serial port. If you want to instantly stop
-printing you may try turning off the printer. With older versions of
-the serial driver, the printer would attempt to resume printing if you
-turned the printer back on again (before the time specified by
-closing_wait of setserial had expired). The attempt to resume would
-happen even if you used a command to stop the printing. The problem
-was that once the printer software sent bytes to the large serial
-buffer to be printed, these bytes were not removed from this buffer
-when the print job was canceled. One way to remove them (for newer
-serial drivers) is to simply turn off the printer. This will drop all
-modem control signals from the printer and empty the buffer. Modern
-printers have large buffers and often a button on the printer to empty
-the buffer.
+bytes when its needed. But sometimes they don't. The problem is that
+output to the serial port first passes thru the large serial buffer
+in the PC's main memory. So if you want to abort printing, whatever is
+in this buffer should be removed. When you tell an application program
+to stop printing, it may not empty this buffer so printing continues
+until it's empty. In addition, your printer has it's own buffer which
+needs to be cleared. So telling the PC to stop printing may not work
+due to these two buffers that continue to supply bytes for the printer.
+It's a problem with printer software not knowing about the serial port
+and that modem control lines need to be dropped to stop the printer.
- Known Defective Hardware
- Avoiding IO Address Conflicts with Certain Video Boards Known IO Address Conflicts
+Avoiding IO Address Conflicts with Certain Video Boards
The IO address of the IBM 8514 video board (and others) is
allegedly 0x?2e8 where ? is 2, 4, 8, or 9. This may conflict (but
@@ -3113,7 +3200,14 @@ try to use setserial to put IO address conflict with ide2 hard drive
+
The address of ttyS2 is 3e8-3ef while hard drive ide2 uses 3ee
+which is in this range. So when booting Linux you may see a report
+of this conflict. Most people don't use ide2 (the 3rd hard drive
+cable) and may ignore this conflict message. You may have 2 hard
+drives on ide0 and two more on ide1 so most people don't need ide2.
+ Known Defective Hardware
Problem with AMD Elan SC400 CPU (PC-on-a-chip)
This has a race condition between an interrupt and a status register
of the UART. An interrupt is issued when the UART transmitter
@@ -3150,16 +3244,16 @@ LED lamps which light when certain modem control lines are asserted
signal (positive or negative voltage). Still others have jumpers so
that you can connect any wire to any wire. Some have switches.
-Radio Shack sells (in 2001) a "RS-232 Troubleshooter" (formerly called
-"RS-232 Line Tester") Cat. #276-1401. It checks TD, RD, CD, RTS,
-CTS, DTR, and DSR. A green light means on (+12 v) while red means
-off (-12 v). They also sell a "RS-232 Serial Jumper Box" Cat.
+Radio Shack sells (in 2002) a "RS-232 Troubleshooter" (formerly called
+"RS-232 Line Tester") Cat. #276-1401. It checks TD, RD, CD, RTS, CTS,
+DTR, and DSR. A green light means on (+12 v) while red means off (-12
+v). They also sell a "RS-232 Serial Jumper Box" Cat.
#276-1403. This permits connecting the pins anyway you choose. Both
these items are under the heading of "Peripheral hookup helpers".
Unfortunately, they are not listed in the index to the printed
-catalog. They are on the same page as the D type connecters so
-look in the index under "Wire & Cable, Connectors. Or look
-under "Tools, D-Sub Connection Pin ...". A store chain named "Active Component
+catalog. They are on the same page as the D type connecters so look
+in the index under "Connectors, Computer, D-Sub". A store chain named
+"Active Components" may have them.
Measuring voltages
Any voltmeter or multimeter, even the cheapest that sells for
@@ -3211,28 +3305,38 @@ Nov. '00: which connector is ttyS1, etc. Input/output error, overrun
error link
Dec. '00: /proc/tty/driver/serial shows info, I/O error+, pid 161 in
example n.g.
+July '02: typo: is doesn't => it doesn't, clarity re port not found
+Dec. '02: IO error may mean IRQ conflict or IO address conflict.
+Jan. '03: LSR safety check error
+Feb. '03: Interrupts may be shared on PCI Bus
-->
(The following subsections are in both the Serial and Modem HOWTOs)
My Serial Port is Physically There but Can't be Found
- If a physical device (such as a modem) doesn't work at all it may
-mean that the device is not at the I/O address that setserial
-thinks it's at. It could also mean (for a PnP card) that is doesn't
-yet have an address. Thus it can't be found.
+
If a physical device (such as a modem) doesn't work at all it's
+often because it's disabled and has no address (PnP hasn't enabled it)
+or that it is enabled but is not at the I/O address that setserial
+thinks it's at. Thus it can't be found.
-Check the BIOS menus and BIOS messages. For the PCI bus use lspci or
-scanpci. If it's an ISA bus PnP serial port, try "pnpdump --dumpregs"
-and/or see Plug-and-Play-HOWTO. Using "scanport" will scan all ISA
-bus ports and may discover an unknown port that could be a serial port
-(but it doesn't probe the port). It could hang your PC. You may try
-probing with setserial. See [. If
-nothing seems to get thru the port it may be accessible but have a bad
-interrupt. See ][. Use ]setserial -g to
-see what the serial driver thinks and check for IRQ and I0 address
+First check BIOS messages at boot-time (and possible the BIOS menu for
+the serial port). For the PCI bus use lspci or scanpci. If it's an
+ISA bus PnP serial port, try "pnpdump --dumpregs" and/or see
+Plug-and-Play-HOWTO. If the port happens to be enabled then the
+following two paragraphs may help find it:
+
+For a non-PnP ISA legacy port, using "scanport" (Debian only ??) will
+scan all bus ports and may discover an unknown port that could be a
+serial port (but it doesn't probe the port). It could hang your PC.
+You may try probing with setserial. See [.
+
+If nothing seems to get thru the port it may be accessible but have a
+bad interrupt. See ][. Use ]setserial -g
+to see what the serial driver thinks and check for IRQ and I0 address
conflicts. Even if you see no conflicts the driver may have incorrect
-information (view it by "setserial" and conflicts may still exist.
+information (view it by "setserial") and conflicts may still exist.
If two ports have the same IO address then probing it will erroneously
indicate only one port. Plug-and-play detection will find both ports
@@ -3310,14 +3414,14 @@ will only make things worse.
The Startup Screen Show Wrong IRQs for the Serial Ports.
- Linux does not do any IRQ detection on startup. When the serial
-module loads it only does serial device detection. Thus, disregard
-what it says about the IRQ, because it's just assuming the standard
-IRQs. This is done, because IRQ detection is unreliable, and can be
-fooled. But if and when setserial runs from a start-up script, it
-changes the IRQ's and displays the new (and hopefully correct) state
-on on the startup screen. If the wrong IRQ is not corrected by a
-later display on the screen, then you've got a problem.
+
For non-PnP ports, Linux does not do any IRQ detection on startup.
+When the serial module loads it only does serial device detection.
+Thus, disregard what it says about the IRQ, because it's just assuming
+the standard IRQs. This is done, because IRQ detection is unreliable,
+and can be fooled. But if and when setserial runs from a start-up
+script, it changes the IRQ's and displays the new (and hopefully
+correct) state on on the startup screen. If the wrong IRQ is not
+corrected by a later display on the screen, then you've got a problem.
So, even though I have my
@@ -3381,25 +3485,27 @@ have been automatically removed if it contained a stale process id
"/dev/tty? Device or resource busy"
This means that the device you are trying to access (or use) is
supposedly busy (in use) or that a resource it needs (such as an IRQ)
-is supposedly being used by another device (the resource is "busy").
+is supposedly being used by another device and can't be shared.
This message is easy to understand if it only means that the device is
-busy (in use). But it often means that a resource is in use. What
-makes it even more confusing is that in some cases neither the device
-nor the resources that it needs are actually "busy".
+busy (in use). But it often means that a needed resource is already
+in use (busy). What makes it even more confusing is that in some cases
+neither the device nor the resources that it needs are actually
+"busy".
-The ``resource busy'' part often means (example for
What you need to do is to find the interrupt setserial thinks
- "Input/output error" from setserial or stty
-
You may have typed "ttys" instead of "ttyS". You will see this
-error message if you try to use the setserial command for any device
-that is not a serial port. It also may mean that the serial port is
-in use (busy or opened) and thus the attempt to get/set parameters by
-setserial or stty failed. It could also mean that there isn't any
-serial port at the IO address that setserial thinks your port is at.
+"Input/output error" from setserial, stty, pppd, etc.
+ This means that communication with the serial port isn't working
+right. It could mean that there isn't any serial port at the IO
+address that setserial thinks your port is at. It could also be an
+interrupt conflict (or an IO address conflict). It also may mean that
+the serial port is in use (busy or opened) and thus the attempt to
+get/set parameters by setserial or stty failed. It will also happen
+if you make a typo in the serial port name such as typing "ttys"
+instead of "ttyS".
- Overrun errors on serial port
+"LSR safety check engaged"
+LSR is the name of a hardware register. It's claimed that this
+means there is no serial port at the specified address.
+
+Overrun errors on serial port
This is an overrun of the hardware FIFO buffer and you can't
increase its size. Bug note (reported in 2002): Due to a bug in some
kernel 2.4 versions, the port number may be missing and you will only
@@ -3718,7 +3829,7 @@ rates (speeds) which it can use at its serial port interface.
Dumb UARTs are the 8250, 16450, early 16550, and early 16650. They
are obsolete but if you understand how they work it's easy to
understand how the modern ones work with FIFO UARTS ( late 16550,
-16550A, 16c552, late 16650, 16750, and 16C950).
+16550A, and higher numbers)
There is some confusion regarding 16550. Early models had a bug and
worked properly only as 16450's (no FIFO). Later models with the bug
@@ -3809,24 +3920,23 @@ was large, then many more bytes would be sent in violation of flow
control's request to stop.
UART Model Numbers
- Here's a list of UARTs. Here's a list of some UARTs.
- 8250, 16450, early 16550: Obsolete with 1-byte buffers
-
- 16550, 16550A, 16c552: 16-byte buffers, TL=1,4,8,14
-
- 16650: 32-byte buffers. Speed up to 460.8 kbps
-
- 16750: 64-byte buffer for send, 56-byte for receive. Speed up
- to 921.6 kbps
+
- 16550, 16550A, 16C552: 16-byte buffers, TL=1,4,8,14;
+ 115.2 kbps standard, many support 230.4 or 460.8 kbps
+
- 16650: 32-byte buffers. 460.8 kbps
+
- 16750: 64-byte buffer for send, 56-byte for receive. 921.6 kbps
+
- 16850, 16C850: 128-byte buffers. 460.8 kbps or 1.5 mbps
+
- 16950
- Hayes ESP: 1k-byte buffers.
-The obsolete ones are only good for modems no higher than 14.4k (DTE
-speeds up to 38400 bps). For modern modems you need at least a 16550
-(and not an early 16550). For V.90 56k modems, it may be a several
-percent faster with a 16650 (especially if you are downloading large
-uncompressed files). The main advantage of the 16650 is its larger
-buffer size as the extra speed isn't needed unless the modem
-compression ratio is high. Some 56k internal modems may come with a
-16650 ??
+For V.90 56k modems, it may be a several percent faster with a 16650
+(especially if you are downloading large uncompressed files). The
+main advantage of the 16650 is its larger buffer size as the extra
+speed isn't needed unless the modem compression ratio is high. Some
+56k internal modems may come with a 16650 ??
Non-UART, and intelligent multiport boards use DSP chips to
do additional buffering and control, thus relieving the CPU
@@ -3943,7 +4053,7 @@ Only RTS/CTS flow control will be discussed since DTR/DSR flow control
works the same way. To get RTS/CTS flow control one needs to either
select hardware flow control in an application program or use the
command:
-stty crtscts < /dev/ttyS2 (or the like). This enables RTS/CTS
+stty -F /dev/ttyS2 crtscts (or the like). This enables RTS/CTS
hardware flow control in the Linux device driver.
Then when a DTE (such as a PC) wants to stop the flow into it, it
@@ -4148,13 +4258,17 @@ the next byte.
Successors to EIA-232
A number of EIA standards have been established for higher speeds
and longer distances using twisted-pair (balanced) technology.
-Balanced transmission can sometimes be a hundred times faster than
-unbalanced EIA-232. For a given speed, the distance (maximum cable
-length) may be many times longer with twisted pair. But PC-s keep
-being made with the "obsolete" EIA-232 since it works OK with modems
-and mice since the cable length is short. If this appears in the
-latest version of this HOWTO, please let me know if any of the
-non-EIA-232 listed below are supported by Linux.
+Balanced transmission make possible higher speeds, and can be a
+hundred times faster than unbalanced EIA-232. For a given speed, the
+distance (maximum cable length) may be many times longer with twisted
+pair. But PC-s keep being made with the "obsolete" EIA-232 since it
+works OK with modems and mice since the cable length is short. If
+this appears in the latest version of this HOWTO, please let me know
+if any of the non-EIA-232 listed below are supported by Linux.
+
+High speed serial ports (over 460.8 kbps) will often support both
+EIA-232 and EIA-485/EIA-422 modes. At such high speeds EIA-232 is not
+of much use (except for a very short cable).
EIA-422-A (balanced) and EIA-423-A (unbalanced)
EIA-423 is just like the unbalanced EIA-232 except that the
@@ -4162,33 +4276,36 @@ voltage is only 5 volts. Since this falls within EIA-232 specs it
can be connected to a EIA-232 port. Its specs call for somewhat
higher speeds than the EIA-232 (but this may be of little help on a
long run where it's the unbalance that causes interference). Since
-EIA-423 is not much of an improvement over EIA-232, it is not popular
+EIA-423 is not much of an improvement over EIA-232, it is seldom used
except on old Mac computers.
EIA-422 is twisted pair (known as "balanced" or "differential) and is
(per specs) exactly 100 times as fast as EIA-423 (which in turn is
-somewhat faster than EIA-232). Apple's Mac computer prior to mid-1998
-with its EIA-232/EIA-422 Port uses it. The Mac used a small round
-"mini-DIN-8" connector. It also provided conventional EIA-232 but at
-only at 5 volts (which is still legal EIA-232). To make it work like
-at EIA-232 one must use a special cable which (signal) grounds RxD+
-(one side of a balanced pair) and use RxD- as the receive pin. While
-TxD- is used as the transmit pin, for some reason TxD+ should not be
-grounded. See . However, due to the fact that
-Macs (and upgrades for them) cost more than PC's, they are not widely
-as host computers for Linux.
+somewhat faster than EIA-232). Apple's Mac computer used it prior to
+mid-1998 with its EIA-232/EIA-422 port. The Mac used a small round
+"mini-DIN-8" connector and named these serial ports as "modem port",
+"printer port", and/or "GeoPort".
+
+Mac also provided conventional EIA-232 but at only at 5 volts (which
+is still legal EIA-232). To make it work like at EIA-232 one must use
+a special cable which (signal) grounds RxD+ (one side of a balanced
+pair) and use RxD- as the receive pin. While TxD- is used as the
+transmit pin, for some reason TxD+ should not be grounded. See . However, due to the fact that Macs (and
+upgrades for them) cost more than PC's, they are not widely as host
+computers for Linux.
EIA-485
This is like EIA-422 (balanced = differential). It is
-half-duplex. It's not just point-to-point but is like ethernet or
-the USB since all devices (nodes) on it share the same "bus". It may
-be used for a multidrop LAN (up to 32 nodes or more). Since many
-nodes share the same twisted pair the need to use the electrical
-tri-state mode where besides the 0 and 1 binary states there is also
-an open circuit state to permit other nodes to uses the twisted pair
-line. Instead of a transmitter keeping a 1-state voltage on the line
-during line idle, the line is open circuited and all nodes just listen
+half-duplex. It's not just point-to-point but is like ethernet or the
+USB since all devices (nodes) on it share the same "bus". It may be
+used for a multidrop LAN (up to 32 nodes or more). Since many nodes
+share the same twisted pair, there's a need to use the electrical
+tri-state mode. Besides the 0 and 1 binary states there is also an
+open circuit state to permit other nodes to use the twisted pair line.
+Instead of a transmitter keeping a 1-state voltage on the line during
+line idle, the line is open circuited and all nodes just listen
(receive mode).
The most common architecture is master/slave. The master polls the
@@ -4245,16 +4362,18 @@ conductors. You may compile firewire support into the Linux kernel.
Like USB, it's also limited to short distances.
MIDI
-Sound cards often have a 15-pin MIDI connector. There are also
-such connectors not associated with a sound card. They are for
-connecting a musical keyboard to a PC so that you can create musical
-recordings. You could also connect a MIDI sound system. The MIDI
-standard uses 31250 baud (1M/32) which is not available on an ordinary
-serial port. Some MIDI devices are designed so that they can be
-connected directly to an ordinary serial port.
+
Sound cards often have a 15-pin game port connector used for MIDI.
+They are for connecting a musical keyboard to a PC so that you can
+create musical recordings. You could also connect a MIDI sound
+system. The MIDI standard uses 31250 baud (1M/32) which is not
+available on an ordinary serial port. Some MIDI devices are designed
+so that they can be connected directly to an ordinary serial port.
-Besides the 15-pin connector, many use a 5-pin DIN connector.
-The /dev/midi00 is for MIDI.
+Besides the 15-pin connector, a 5-pin DIN connector is also a MIDI
+standard but the flow of sound is only one way thru it so for
+bidirectional sound you need 2 of them. Breakout cables often have a
+15-pin connector on one end and 2 or more 5-pin connectors on the
+other end. The /dev/midi00 is for MIDI.
Synchronization & Synchronous
Beside the asynchronous EIA-232 (and others) there are a number of
@@ -4436,7 +4555,7 @@ meaning of "stty" commands, etc.
Replacing obsolete UARTS
Many 486 PCs (old) and all Pentiums (or the like) should have
modern 16550As (usually called just 16550's) with FIFOs. If you have
-something really old the chip may unplug so that you may be able to
+something really old, the chip may unplug so that you may be able to
upgrade by buying a 16550A chip and replacing your existing 16450
UART. If the functionality has been built into another type of chip,
you are out of luck. If the UART is socketed, then upgrading is easy
@@ -4447,4 +4566,3 @@ the Internet (few retail stores stock them today) or find a used one.
END OF Serial-HOWTO
-