From 0ea92085260f1d9948c245a1399da4626291afe7 Mon Sep 17 00:00:00 2001 From: gferg <> Date: Wed, 3 Nov 2010 13:20:40 +0000 Subject: [PATCH] updated --- LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml | 2 +- LDP/howto/docbook/HOWTO-INDEX/hwSect.sgml | 2 +- LDP/howto/linuxdoc/Serial-HOWTO.sgml | 445 +++++++++---------- 3 files changed, 205 insertions(+), 244 deletions(-) diff --git a/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml b/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml index a3541faf..a06fc36c 100644 --- a/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml +++ b/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml @@ -4032,7 +4032,7 @@ Addresses Linux localization issues specific to Serbian users Serial-HOWTO, Serial HOWTO -Updated: Dec 2008. +Updated: Nov 2010. Describes serial port features other than those which should be covered by other HOWTOs. Lists information on multiport serial cards and contains detailed technical information about the serial port diff --git a/LDP/howto/docbook/HOWTO-INDEX/hwSect.sgml b/LDP/howto/docbook/HOWTO-INDEX/hwSect.sgml index 449fbea6..e6cf2b8b 100644 --- a/LDP/howto/docbook/HOWTO-INDEX/hwSect.sgml +++ b/LDP/howto/docbook/HOWTO-INDEX/hwSect.sgml @@ -1166,7 +1166,7 @@ writers may need to know. Serial-HOWTO, Serial HOWTO -Updated: Dec 2008. +Updated: Nov 2010. Describes serial port features other than those which should be covered by other HOWTOs. Lists information on multiport serial cards and contains detailed technical information about the serial port diff --git a/LDP/howto/linuxdoc/Serial-HOWTO.sgml b/LDP/howto/linuxdoc/Serial-HOWTO.sgml index 0a2a030a..ebd757ec 100644 --- a/LDP/howto/linuxdoc/Serial-HOWTO.sgml +++ b/LDP/howto/linuxdoc/Serial-HOWTO.sgml @@ -1,20 +1,15 @@
- Serial HOWTO <author>David S.Lawyer <tt><htmlurl url="mailto:dave@lafn.org" name="dave@lafn.org"></tt> original by Greg Hankins -<date> v2.27 December 2008 +<date> v2.26 November 2010 <!-- Change log: -2.27 Dec. 2008: Changed 12 volts to 5 volts for typical serial port -voltages today. generic_serial.ko module is not utilized by serial -drivers. Use 8250.nr_uarts=16 etc. if serial support built into -kernel and use nr_uarts=16 if a module. Erroneously had this -reversed. -2.26 Nov. 2008: Changed EIA-232 to RS-232. PCI-e bus is serial. No -serial ports on most new PCs => serial port obsolete for desktop. -2.25 Jan. 2007: picocom. devfs is obsolete. ser2net. Revised parts on +2.26 Nov. 2010 Changed EIA-232 to RS-232. PCI-e bus is serial. No +serial port on new PCs since it's obsolete and this HOWTO is now +mainly of historical interest. +2.25 Jan. 2007 picocom. devfs is obsolete. ser2net. Revised parts on drivers as modules vs. built into kernel. Serial Programming wikibook. 2.24 Feb. 2006: Serial Laplink HOWTO (connecting 2 PCs via the @@ -61,42 +56,43 @@ v2.00 May 1999 holding reg. to shift reg. only about the serial port. v1.12 July 1998: reissue of old doc (v1.11). Added more info on Winmodems. v1.11 15 November 1997 by Greg Hankins -(Prior to v1.11 a number of versions are missing from the list below -since I didn't think searching for them was worthwhile.) +(Prior to this, a number of versions are not listed and it would take + some research to determine them) v1.8.1: 9 Oct. 1995 v1.7: 29 Oct. 1994 v1.0: 6 Jan. 1994: first Serial-HOWTO by Greg Hankins v1.0: June 1993: was called Serial FAQ, by Greg Hankins --> <abstract> - This document describes the UART serial port features other than - those which should be covered by Modem-HOWTO, PPP-HOWTO, - Serial-Programming-HOWTO, or Text-Terminal-HOWTO. It lists info on - multiport serial cards. It contains technical info about the serial - port itself in more detail than found in the above HOWTOs and should - be best for troubleshooting when the problem is the serial port - itself. If you are dealing with a Modem, PPP (used for Internet - access on a phone line), or a Text-Terminal, those HOWTOs should be - consulted first. It's also useful as an introduction to how the - serial port works before reading other documents on how to program - it. </abstract> + This document describes the now obsolete UART serial port features +other than those which should be covered by Modem-HOWTO, PPP-HOWTO, +Serial-Programming-HOWTO, or Text-Terminal-HOWTO. It lists info on +multiport serial cards. It contains technical info about the serial +port itself in more detail than found in the above HOWTOs and should +be best for troubleshooting when the problem is the serial port +itself. If you are dealing with a Modem, PPP (used for Internet +access on a phone line), or a Text-Terminal, those HOWTOs should be +consulted first. </abstract> <toc> <sect>Introduction -<p> This HOWTO covers basic info about the old analog Serial Port and -multiport serial cards. It contains much more information in it than -most people who use serial ports need to know and most people are able -to use the serial port without reading this HOWTO. But if you're -having problems or just want to understand how it works, this is one -place to find out about it. +<p> This HOWTO covers basic info on the now obsolete serial port and +multiport serial cards. It was written when the serial port was a +major port for connecting a PC to other devices and the style of this +article reflects this. It is mostly in the present tense but due to +the historical nature of the serial port it probably should be in the +past tense. It thus hasn't been modified to have the tone of a +historical document. It contains much more information in it than +most people needed to know and most people were able to use the serial +port without reading this HOWTO. But if you're having problems with +it or just want to understand how it worked this is one place to find +out about it. -This HOWTO is about the old and slow original serial port but it could -have been designed to be much faster. See <ref id="slow_" name="RS-232 -Cable Is Low Speed & Short Distance">. It uses a UART chip and is -sometimes called a "UART serial port" to differentiate it from the -newer types of serial devices: Universal Serial Bus or IEEE 1394 -(Firewire). Information specific to devices which use serial ports: +This HOWTO is about the slow original serial port which uses a UART +chip and is sometimes called a "UART serial port" to differentiate it +from the newer types of serial devices: Universal Serial Bus or +Firewire. Information specific to devices which use serial ports: modems, text-terminals, infrared devices, and a few printers are found in Modem-HOWTO, Text-Terminal-HOWTO, Infrared-HOWTO, and Printing-HOWTO. Info on getty (the program that runs the login @@ -116,7 +112,7 @@ might be valid for other architectures. <sect1> Copyright, Disclaimer, & Credits <sect2>Copyright <p> -Copyright (c) 1993-1997 by Greg Hankins, (c) 1998-2009 by David S. +Copyright (c) 1993-1997 by Greg Hankins, (c) 1998-2005 by David S. Lawyer <url url="mailto:dave@lafn.org"> <!-- license.D begin --> @@ -154,62 +150,57 @@ respective owners. <!-- license.D end --> <sect2>Credits <p> Most of the original Serial-HOWTO was written by Greg Hankins. -<url url="mailto:gregh@twoguys.org">. He also rewrote many -contributions by others in order to maintain continuity in the writing -style and flow. He wrote: ``Thanks to everyone who has contributed or -commented, the list of people has gotten too long to list (somewhere -over one hundred). Special thanks to Ted Ts'o for answering questions -about the serial drivers.'' Approximately half of v2.00 was from Greg -Hankins HOWTO and the other half were additions by David Lawyer. Ted -Ts'o has continued to be helpful. In Jan. 2006 "Charles Brockman" -found many typos (which I fixed). +<url url="mailto:gregh@twoguys.org"> +He also rewrote many contributions by others in order to maintain +continuity in the writing style and flow. He wrote: ``Thanks to +everyone who has contributed or commented, the list of people has +gotten too long to list (somewhere over one hundred). Special thanks +to Ted Ts'o for answering questions about the serial drivers.'' +Approximately half of v2.00 was from Greg Hankins HOWTO and the other +half were additions by David Lawyer. Ted Ts'o has continued to be +helpful. In Jan. 2006 "Charles Brockman" reviewed it for typos which +resulted in many typos being fixed. <sect1> New Versions of this Serial-HOWTO -<p> Since the serial port is legacy technology and much faster means of -communication exist, new versions of the Serial-HOWTO will be released -every year or so. A list of mirror sites where you'll find copies is -at <url url="http://www.tldp.org/mirrors.html">. If you only want to -quickly check the date of the latest version look at <url +<p> New versions will be issued infrequently (if at all) due to the +obsolesence of the serial port. They will be available to browse +and/or download at LDP mirror sites see: <url +url="http://www.tldp.org/mirrors.html">. Various formats are +available. If you only want to quickly check the date of the latest +version look at <url url="http://www.tldp.org/HOWTO/Serial-HOWTO.html"> and compare it to -this version: v2.27 December 2008 . +this version: v2.26 November 2010 . -<sect1>New in Recent Versions -<p> For a full revision history going back to the time I started -maintaining this HOWTO, see the source file (in linuxdoc format): -<url -url="http://cvs.tldp.org/go.to/LDP/LDP/howto/linuxdoc/Serial-HOWTO.sgml?view=markup" name="(cvs) Serial-HOWTO.sgml"> -<itemize> -2.27 Dec. 2008: Changed 12 volts to 5 volts for typical serial port -voltages today. generic_serial.ko module is not utilized by serial -drivers. Use 8250.nr_uarts=16 etc. if serial support built into -kernel and use nr_uarts=16 if a module. Erroneously had this -reversed. -<item>2.26 Nov. 2008: Changed EIA-232 to RS-232. PCI-e bus is serial. -No serial port on most new PCs. +<sect1>New in Recent Versions <p> For a full revision history going +back to the time I started maintaining this HOWTO, see the source file +(in linuxdoc format): <url +url="http://cvs.tldp.org/go.to/LDP/LDP/howto/linuxdoc/Serial-HOWTO.sgml?view=markup" +name="(cvs) Serial-HOWTO.sgml"> <itemize> +<item>2.26 Nov. 2010 Changed EIA-232 to RS-232. PCI-e bus is serial. No +serial port on new PCs since it's obsolete and this HOWTO is now +mainly of historical interest. <item>2.25 Jan. 2007 picocom. devfs is obsolete. ser2net. Revised parts on drivers as modules vs. built into kernel. Serial Programming wikibook. </itemize> -<sect1> Related HOWTO's, etc. about the Serial Port <label -id="related_howtos"> <p> Modems, Text-Terminals, some printers, and -other peripherals often use the serial port. Get these HOWTOs from -the nearest mirror site as explained above. +<sect1> Related HOWTO's, etc. about the Serial Port <label id="related_howtos"> +<p> Modems, Text-Terminals, some printers, and other peripherals often +used the serial port. Get these HOWTOs from the nearest mirror site as +explained above. <itemize> <item><tt>Modem-HOWTO</tt> is about installing and configuring modems <item><tt>Printing-HOWTO</tt> has info for serial printers using old lpr command <item><tt>LPRng-HOWTO</tt> (not a LDP HOWTO, may come with software) -has info for using the serial port for connecting to old printers -using the "Next Generation" lpr program. + has info for serial printing for "Next Generation" lpr <item> <url url="http://en.wikibooks.org/wiki/Programming:Serial_Data_Communications" name="Serial Programming"> is a wiki-book - on the Internet <label id="ser_prog_wiki"> + on the Internet <item><tt>Serial-Programming-HOWTO</tt> helps you write C programs that read and write to the serial port - and/or check/set its state. A better version written by Vern - Hoxie but not submitted to LDP is at <ref id="verns_serial_HT" - name="Serial Programming HOWTO"> + and/or check/set its state. A version written by Vern + Hoxie but not submitted to LDP is at <ref id="vern_" name="Internet">. <item><tt>Text-Terminal-HOWTO</tt> is about how they work, how to install configure, and repair them. It includes a section on "Make a Terminal the Console" which is useful for using a remote terminal to @@ -219,12 +210,13 @@ using the "Next Generation" lpr program. </itemize> <sect1>Feedback -<p> Please send me any suggestions, or additional material. Tell me -what you don't understand, or what could be clearer. You can reach me -via email at <tt><url url="mailto:dave@lafn.org"></tt>. +<p> Please send me any suggestions, correction or additional +material. Tell me what you don't understand, or what could be +clearer. You can reach me via email at <tt><url +url="mailto:dave@lafn.org"></tt>. <sect1> What is a Serial Port? -<p> The conventional serial port (not the newer USB port, or 1394 +<p> The conventional serial port (not the newer USB port, or Firewire port) is a very old I/O (Input/Output) port. Until around 2006, most new desktop PC's had one, and old PC's from the 1990's sometimes had 2 of them. Most laptops gave up them before the desktops did. Macs @@ -253,7 +245,7 @@ voltage meaning "off" and a steady positive voltage meaning "on". The UART (Universal Asynchronous Receiver-Transmitter) chip does most of the work. Today, the functionality of this chip is usually built into another chip. See <ref id="uart_" name="What Are UARTs?"> These -have improved over time and old models (prior to say 1994) are very +have improved over time and old models (prior to say 1994) are usually obsolete. The serial port was originally designed for connecting external modems @@ -264,26 +256,20 @@ internal modem cards have a built-in serial port so when you install one inside your PC it's as if you just installed another serial port in your PC. -The serial port is part of what Linux kernel programmers call the "tty -layer". The text interface using the console on a PC is also part of -the tty layer. Starting in 2005, Alan Cox and others made major -improvements to this tty layer. A significant amount of work still -was underway in 2008 to eliminate bugs including "race conditions" in -this layer. - <sect> Quick Help <p>This repeats more detailed information found elsewhere. If your computer can't seem to find your serial port and you already know something about hardware resources (addresses like 3F8 and IRQs like 5) then try this: First, get into the BIOS (often called "setup") when the computer is powered on by pressing certain keys. To find out -what keys to press, freeze the first words that flash by on the screen +what keys to press, watch the screen as your PC starts up. If +the words that flash by on the screen too fast to read, freeze them by holding down the "pause" and "shift" keys at the same time. Then -hit any key to resume (cease pausing) and hold down the key(s) -required to enter the BIOS setup. You may have to try this again -since there may be more than one screen which you can freeze with the -"pause" key. Also, look for messages about the serial ports on these -frozen screens. +when read, hit any key to resume (cease pausing) and hold down the +key(s) required to enter the BIOS setup. You may have to try this +again since there may be more than one screen which you can freeze +with the "pause" key. Also, look for messages about the serial ports +on these frozen screens. Once in the BIOS menus, try to find menus dealing with the serial port. They could be shown in a menu dealing with Resources, Plug-and-Play, @@ -417,14 +403,14 @@ buffer. Then the port gives the CPU an interrupt to tell it to pick up that byte so that the serial port will have room for storing the next byte which is currently being received. For newer serial ports with 16-byte buffers, this interrupt (to fetch the bytes) may be sent -when 14 bytes are in the receive buffer. The CPU then stops what it +after 14 bytes are in the receive buffer. The CPU then stops what it was doing, runs the interrupt service routine, and picks up 14 to 16 bytes from the port. For an interrupt sent when the 14th byte has been received, there could be 16 bytes to get if 2 more bytes have arrived since the interrupt. But if 3 more bytes should arrive (instead of 2), then the 16-byte buffer will overrun. It also may -pick up less than 14 bytes by setting it up that way or due to -timeouts. See <ref id="fifo_" name="FIFOs"> for more details. +pick up less than 14 bytes by setting it that way or due to timeouts. +See <ref id="fifo_" name="FIFOs"> for more details. <sect1> The Large Serial Buffers <p> We've talked about small 16-byte serial port hardware @@ -433,11 +419,11 @@ the CPU takes some bytes out of the receive buffer of the hardware, it puts them into a much larger (say 8k-byte) receive buffer in main memory. Then a program that is getting bytes from the serial port takes the bytes it's receiving out of that large buffer (using a -"read" statement in a program). A similar situation exists for +"read" statement in the program). A similar situation exists for bytes that are to be transmitted. When the CPU needs to fetch some bytes to be transmitted it takes them out of a large (8k-byte) transmit buffer in main memory and puts them into the small 16-byte -transmit buffer in the uart hardware. +transmit buffer in the hardware. <sect> Serial Port Basics <label id="basics_"> <!-- basics.D begin <sect> Serial Port and Modem Basics @@ -469,15 +455,15 @@ name="How the Hardware Transfers Bytes"> but in greater detail. <!-- ifdef SERIAL_ --> An I/O device is just a way to get data into and out of a computer. -There are many types of I/O devices such as the older serial ports and -parallel ports, network cards, universal serial buses (USB), and -firewire etc. +There are many types of I/O devices such as serial ports, parallel +ports, disk drive controllers, ethernet boards, universal serial +buses, etc. <!-- ifdef SERIAL_ end --> -Most pre-2007 PC's have a serial port or two (on older PC's). Each -has a 9-pin connector (sometimes 25-pin) on the back of the computer. -Computer programs can send data (bytes) to the transmit pin (output) -and receive bytes from the receive pin (input). The other pins are -for control purposes and ground. +Most PC's have one or two serial ports. Each has a 9-pin connector +(sometimes 25-pin) on the back of the computer. Computer programs can +send data (bytes) to the transmit pin (output) and receive bytes from +the receive pin (input). The other pins are for control purposes and +ground. The serial port is much more than just a connector. It converts the data from parallel to serial and changes the electrical representation @@ -497,8 +483,8 @@ things. <sect2> Pins and Wires <p> Old PC's used 25 pin connectors but only about 9 pins were -actually used so later on most connectors were only 9-pin. Each of -the 9 pins usually connects to a wire. Besides the two wires used for +actually used so today most connectors are only 9-pin. Each of the 9 +pins usually connects to a wire. Besides the two wires used for transmitting and receiving data, another pin (wire) is signal ground. The voltage on any wire is measured with respect to this ground. Thus the minimum number of wires to use for 2-way transmission of data is @@ -531,11 +517,12 @@ Industries Association) and later EIA/TIA after EIA merged with TIA (Telecommunications Industries Association). The EIA-232 spec provides also for synchronous (sync) communication but the hardware to support sync is almost always missing on PC's. The RS designation is -was intended to become obsolete but is still widely used and will be -used in this howto for RS-232. Other documents may use the full -EIA/TIA designation, or just EIA or TIA. For info on other -(non-RS-232) serial ports see the section <ref id="non_rs232" -name="Other Serial Devices (not async RS-232)"> +obsolete but is still widely used and will be used in this howto for +RS-232. Other documents may use the full EIA/TIA designation, or just +EIA or TIA. For info on other (non-RS-232) serial ports see the +section <ref id="non_rs232" name="Other Serial Devices (not async +RS-232)"> + <!-- ifdef SERIAL_ end --> <sect1> IO Address & IRQ @@ -989,42 +976,39 @@ See <ref id="set_serial" name="What is Setserial"> for more info on <!-- basics.D end --> -<sect> Is the Serial Port Obsolete? +<sect> The Serial Port is Now Obsolete <sect1> Introduction -<p> The serial port used to be found on almost all new PC's but not -anymore. Thus as of 2008, it's becoming obsolete, if not already -obsolete. It's often called a "legacy" device, but it's still used by -some for hardware designed to connect to the serial port especially -for computers used as servers by companies. Laptops and Macs stopped -being sold with serial ports several years before desktops did. -However, if one needs a serial port, it's possible to buy one and -install it, such as on the USB bus, and it's still found on older -PC's. Linux supports ordinary analog modems only if they work thru a -serial port (although the port is likely to be built into the modem) -so a PC often has a serial port even if you can't find any serial port -connector on the back of the PC. +<p> The serial port is today (2010) obsolete (and often called a "legacy" +device) but it is still in use on some older computers, especially for +Linux. The serial port has many shortcomings and after about 2005 +most new PC's no longer had them. Most laptops and Macs discontinued +them even earlier. During the era when some new PC's came with serial +ports and others didn't, the PC's that didn't have serial ports were +called "legacy-free". However, while PC's today no longer have serial +ports, some do have them built into a modem (which plugs into a +telephone line). Such a serial port only works with the modem and +can't be used for any other device. The reason they have such a +"built in" serial port is that analog modems are designed to only work +thru a serial port. -The external serial port connector on the back of a PC, must pass data -via an external cable connected to that connector. Thus it has two -interfaces: the serial-port-to-external-cable and the -serial-port-to-computer-bus. Both of these interfaces are slow. -First we'll consider the interface via external cable to the outside -world. +The physical serial port on the back of an old PC, must pass data between +the computer and an external cable. Thus it has two interfaces: the +serial-port-to cable and the serial-port-to-computer-bus. Both of +these interfaces are slow. First we'll consider the interface via +external cable to the outside world. <sect1> RS-232 Cable Is Low Speed & Short Distance -<label id="slow_"> <p> The conventional RS-232 serial port is inherently low speed and -is severely limited in distance. Ads used to read "high speed" but it +is severely limited in distance. Ads often read "high speed" but it can only work at "high speed" over very short distances such as to a -modem located right next to the computer. Compared to other -connections to a PC such as as a USB bus, network card ethernet, or -IEEE 1394 (firewire), this claimed "high speed" for a serial port is -actually low speed. All of the RS-232 serial cable wires use a common -ground return wire so that twisted-pair technology (needed for high -speeds) can't be used without additional hardware. More modern -interfaces for serial ports exist but they are not standard on PC's -like the RS-232 is. See <ref id="non_232" name="Successors to -RS-232">. Some multiport serial cards support them. +modem located right next to the computer. Compared to a network card, +even this "high speed" is actually low speed. All of the RS-232 +serial cable wires use a common ground return wire so that +twisted-pair technology (needed for high speeds) can't be used without +additional hardware. More modern interfaces for serial ports exist +but they are not standard on PC's like the RS-232 is. See <ref +id="non_232" name="Successors to RS-232">. Some multiport serial +cards support them. It is somewhat tragic that the RS-232 standard from 1969 did not use twisted pair technology which could operate about a hundred times @@ -1037,20 +1021,19 @@ was originally designed for connecting a terminal to a low speed modem located nearby, the need for high speed and longer distance transmission was apparently not recognized. The result was that since the serial port couldn't handle high speeds, new types of serial -interfaces were devised that could: Ethernet, USB, IEEE 1394, etc. -All of these use high speed twisted-pair cabling as recommended by the -"Cable Conference" of 1888. +interfaces were devised that could: Ethernet, USB, Firewire, etc. +The final outcome was the demise of the serial port which due to it's +ancient technology became obsolete. <sect1> Inefficient PCI Interface to the Computer (in some cases) + <p> The serial port communicates with the computer via the PCI bus, the LPC bus, X-bus, or ISA bus. The PCI bus is now 32 or 64 bits wide, but the serial port only sends a byte at a time (8 bits wide) which is a waste of PCI bus bandwidth. Not so for the LPC bus which has only a -4-bit wide bus and thus provides an efficient interface even though it -takes two transmissions to send a byte. The ISA bus is usually -16-bits wide and the bus utilization efficiency is intermediate as -compared to efficient LPC and inefficient PCI (although ISA is overall -less efficient due to it's lower speed). +4-bit wide bus and thus provides an efficient interface. The ISA bus +is usually 16-bits wide and the efficiency is intermediate as compared +to efficient LPC and inefficient PCI. <sect> Multiport Serial Boards/Cards/Adapters <sect1> Intro to Multiport Serial @@ -1063,9 +1046,9 @@ both industry and the home). They can connect to computer servers for the purpose of monitoring/controlling the server from a remote location. They were once mainly used for connecting up many dumb terminals and/or modems to serial ports. Today, use of dumb terminals -is rare and several modems (or digital modems) can now be built -into an internal card. So multiport serial cards are not very -significant anymore. +has declined, and several modems (or digital modems) can now be built +into an internal card. So multiport serial cards are not as +significant as they once were. Each multiport card has a number of external connecters (DB-25 or RJ45) so that one may connect up a number of devices (modems, @@ -1077,6 +1060,7 @@ on the ends of cables which come out (externally) from the card (octopus cable). Or they may be on an external box (possibly rack mountable) which is connected by a cable to a multiport card. + <sect1> Dumb vs. Smart Cards <p>Dumb multiport cards are not too much different than ordinary serial ports. They are interrupt driven and the CPU of the computer does @@ -3571,7 +3555,7 @@ since this would not permit someone else to send a message to your terminal using the write or talk program. <sect1>Lock-Files if you use devfs -<p> The abandoned device-filesystem (devfs) had the /dev directory with +<p> The abandoned device-filesystem (devfs) has the /dev directory with subdirectories. As of late 2001, there were problems with lockfiles. For example, the lockfile mechanism considered dev/usb/tts/0 and /dev/tts/0 to be the same device with name "0". Ditto for all other @@ -3666,12 +3650,10 @@ prompt. <sect>Serial Tips And Miscellany <sect1> Serial Modules <label id="ser_module"> -<p> Often the serial driver is provided by modules such as -serial_core.ko and 8250.ko, etc. Note that "8250" is really for the -descendants of the now obsolete 8250 UART, such as the 16xxx series of -UARTS. Drivers for USB serial ports and multiport cards are often -provided as modules. Linux should automatically load any needed -module, so in most cases you have nothing to do. +<p> Often the serial driver is provided as a module(s) such as +generic_serial.ko. Drivers for USB serial ports and multiport cards +are often provided as modules. Linux should automatically load any +needed module, so in most cases you have nothing to do. But sometimes you need to configure Linux to load certain modules or gives parameters to the module or to the kernel. @@ -3700,18 +3682,10 @@ parport_serial is for PCI cards that contain both serial and parallel ports. As a last resort, one may modify the serial driver by editing the -source code. Much of the serial driver used to be found in the file -serial.c. But it's now spread across other files like serial_core.c -and 8250.c. Note that 8250.c includes support for the successors of -8250, namely the 16xxx series such as 16C752 and 16850. The serial module -changed names similarly. Note that the module: generic_serial.ko was -intended to provide support for other serial modules, but it didn't -catch on so it's only used for one multiport serial card. - +source code. Much of the serial driver is found in the file serial.c. For info regarding writing of programs for the serial port see Serial-Programming-HOWTO. It was revised in 1999 by Vern Hoxie but -that revision is not at LDP. See also the Serial wiki <ref -id="ser_prog_wiki" name="Serial-Programming Wiki"> +that revision is not at LDP. <sect1>Kernel Configuration <label id="kernel_conf"> @@ -3723,22 +3697,18 @@ kernel when compiling or by a parameter given to the kernel when it starts (boot-prompt or kernel command line). The kernel configuration parameters: -<tt/CONFIG_SERIAL_8250_RUNTIME_UARTS=32/ and -<tt/CONFIG_SERIAL_8250_NR_UARTS=4/ set the maximum number of ordinary -serial ports (UARTs) equal to 4. Distributions often set this -to 4 before compiling. If you have more than 4 ordinary -serial ports, then you need to change the 4 to whatever. If you -kernel has already been compiled with not enough ports you may -override this via the kernel command line for example: -8250.nr_uarts=16 (if serial support built into the kernel). A boot -loader such as lilo or grub can be told to do this. If serial support -is via a module, such as 8250.ko, then give nr_uarts as a parameter to -the module. You may use the command like: <tt/modinfo 8250/ to see -what parameters the module 8250 (or whatever) will accept. +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 and CONFIG_SERIAL_8250_NR_UARTS=4 +set the maximum number of ordinary serial ports (UARTs) equal to 4. +If you have more than 4 ordinary serial ports, then you need to change +the 4 to whatever. But you may override this via the kernel command +line for example: nr_uarts=16 (if serial support built into the +kernel) or 8250.nr_uarts=16 (if serial support is via a module). The +boot loader such as lilo or grub can be told to do this. <sect1> Serial Console (console on the serial port) <p> See the kernel documentation in: Documentation/serial-console.txt. -See also: Remote-Serial-Console-HOWTO. +Kernel 2.4+ has better documentation. See also "Serial Console" in +Text-Terminal-HOWTO. <sect1> Line Drivers <p> For a text terminal, the RS-232 speeds are fast enough but the @@ -4662,10 +4632,10 @@ Pin # Pin # Acronym Full-Name Direction What-it-May-Do/Mean and signal ground. This is fixed by the hardware and you can't change it. But the other signal lines are controlled by software and may do (and mean) almost anything at all. However they can only be in one of -two states: asserted (+5 volts) or negated (-5 volts). Asserted is +two states: asserted (+12 volts) or negated (-12 volts). Asserted is "on" and negated is "off". For example, Linux software may command that DTR be negated and the hardware only carries out this command and -puts -5 volts on the DTR pin. A modem (or other device) that +puts -12 volts on the DTR pin. A modem (or other device) that receives this DTR signal may do various things. If a modem has been configured a certain way it will hang up the telephone line when DTR is negated. In other cases it may ignore this signal or do something @@ -4710,7 +4680,7 @@ since it connects two PCs without use of a modem. A null-modem cable may also be called a cross-over cable since the wires between pins 2 and 3 cross over each other (if you draw them on a sheet of paper). The above example is for a 25 pin connector but for a 9-pin connector -the pin numbers are just the opposite. +the pin numbers 2 and 3 are just the opposite. The serial pin designations were originally intended for connecting a dumb terminal to a modem. The terminal was DTE (Data Terminal @@ -4745,9 +4715,9 @@ 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 -negates RTS. Negated "Request To Send" (-5 volts) means "request NOT +negates RTS. Negated "Request To Send" (-12 volts) means "request NOT to send to me" (stop sending). When the PC is ready for more bytes -it asserts RTS (+5 volts) and the flow of bytes to it resumes. Flow +it asserts RTS (+12 volts) and the flow of bytes to it resumes. Flow control signals are always sent in a direction opposite to the flow of bytes that is being controlled. DCE equipment (modems) works the same way but sends the stop signal out the CTS pin. Thus it's RTS/CTS flow @@ -4805,16 +4775,16 @@ using minicom but didn't work if the port was using wvdial. Why? <sect1> Preventing a Port From Opening <p> If "stty -clocal" (or getty is used with the "local" flag negated) -then a serial port can't open until DCD gets an assert (+5 volts) +then a serial port can't open until DCD gets an assert (+12 volts) signal. <sect> Voltage Waveshapes <label id="volt_shape"> <sect1> Voltage for a Bit <p> At the RS-232 serial port, voltages are bipolar (positive or -negative with respect to ground) and should be about 5 volts in -magnitude (some are 3 to 12 volts). For the transmit and receive -pins +5 volts is a 0-bit (sometimes called "space") and -5 volts is +negative with respect to ground) and should be about 12 volts in +magnitude (some are 5 or 10 volts). For the transmit and receive +pins +12 volts is a 0-bit (sometimes called "space") and -12 volts is a 1-bit (sometimes called "mark"). This is known as inverted logic since normally a 0-bit is both false and negative while a one is normally both true and positive. Although the receive and transmit @@ -4823,52 +4793,45 @@ logic with a positive voltage being true (or "on" or "asserted") and a negative voltage being false (or "off" or "negated"). Zero voltage has no meaning (except it usually means that the unit is powered off). -Skip this paragraph unless you are interested in unimportant -technicalities. Precisely speaking, the RS-232 spec has the modem -control lines using inverted logic since a positive voltage is logic 0 -(and not logic 1). But the rules (which are also an inverted logic of -sorts) say that logic 0 means asserted. The result is that two -applications of inverted logic result in what appear to be normal -logic for the modem control lines. - A range of voltages is allowed. The specs say the magnitude of a transmitted signal should be between 5 and 15 volts but must never exceed 25 V. Any voltage received under 3 V is undefined (but some -devices will accept a lower voltage as valid). The voltage on older -PC (non-Mac) hardware from say the 1990's is likely to be higher, like -11-12 volts. If you are using a RS-422 port on a Mac computer as an -RS-232 (requires a special cable) or EIA-423 (RS-423) then the voltage -will actually be 5 V. +devices will accept a lower voltage as valid). One sometimes sees +erroneous claims that the voltage is commonly 5 volts (or even 3 +volts) but it's usually 11-12 volts. If you are using a EIA-422 +(RS-422) port on a Mac computer as an RS-232 (requires a special +cable) or EIA-423 (RS-423) then the voltage will actually be only 5 V. +The discussion here assumes 12 V. Note that normal computer logic normally is just a few volts (5 volts was once the standard) so that if you try to use test equipment -designed for testing 3-5 volt computer logic (TTL) on the 12 volts of -an older serial port, it may damage the test equipment. +designed for testing 3-5 volt computer logic (TTL) on the 12 volts of a +serial port, it may damage the test equipment. <sect1> Voltage Sequence for a Byte <label id="byte_seq"> -<p> The transmit pin (TxD) is held at -5 V (mark) at idle when nothing -is being sent. To start a byte it jumps to +5 V (space) for the -start bit and remains at +5 V for the duration (period) of the start +<p> The transmit pin (TxD) is held at -12 V (mark) at idle when nothing +is being sent. To start a byte it jumps to +12 V (space) for the +start bit and remains at +12 V for the duration (period) of the start bit. Next comes the low-order bit of the data byte. If it's a 0-bit -nothing changes and the line remains at +5 V for another bit-period. -If it's a 1-bit the voltage jumps from +5 to -5 V. After that comes -the next bit (-5 V if a 1 or +5 V if a 0), etc., etc. After the -last data bit, a parity bit may be sent and then a -5 V (mark) stop -bit. Then the line remains at -5 V (idle) until the next start bit. +nothing changes and the line remains at +12 V for another bit-period. +If it's a 1-bit the voltage jumps from +12 to -12 V. After that comes +the next bit (-12 V if a 1 or +12 V if a 0), etc., etc. After the +last data bit, a parity bit may be sent and then a -12 V (mark) stop +bit. Then the line remains at -12 V (idle) until the next start bit. Note that there is no return to 0 volts and thus there is no simple way (except by a synchronizing signal) to tell where one bit ends and the next one begins for the case where 2 consecutive bits are the same polarity (both zero or both one). -A 2nd stop bit would also be -5 V, just the same as the first stop +A 2nd stop bit would also be -12 V, just the same as the first stop bit. Since there is no signal to mark the boundaries between these bits, the only effect of the 2nd stop bit is that the line must remain -at -5 V idle twice as long. The receiver has no way of detecting the +at -12 V idle twice as long. The receiver has no way of detecting the difference between a 2nd stop bit and a longer idle time between bytes. Thus communications works OK if one end uses one stop bit and the other end uses 2 stop bits, but using only one stop bit is obviously faster. In rare cases 1 1/2 stop bits are used. This means -that the line is kept at -5 V for 1 1/2 time periods (like a stop bit +that the line is kept at -12 V for 1 1/2 time periods (like a stop bit 50% wider than normal). <sect1> Parity Explained <label id="parity_def"> @@ -4928,9 +4891,9 @@ multi-byte frame and not the serial port frame of a single byte. <p> The RS-232 serial port as implemented on PC is asynchronous which in effect means that there is no "clock" signal sent with "ticks" to mark when each bit is sent.. There are only two states of the -transmit (or receive) wire: mark (-5 V) or space (+5 V). There is +transmit (or receive) wire: mark (-12 V) or space (+12 V). There is no state of 0 V. Thus a sequence of 1-bits is transmitted by just a -steady -5 V with no markers of any kind between bits. For the +steady -12 V with no markers of any kind between bits. For the receiver to detect individual bits it must always have a clock signal which is in synchronization with the transmitter clock. Such a clock would generate a "tick" in synchronization with each transmitted (or @@ -5043,7 +5006,7 @@ topic. <sect1> The Universal Serial Bus (USB) <p> The Universal Serial Bus (USB) is being built into PCI chips. -All modern PC's have them. It was originally 12 Mbps but is now 480 Mbps +Newer PC's have them. It was originally 12 Mbps but is now 480 Mbps over a twisted pair with a 4-pin connector (2 wires are power supply). It also is limited to short distances of at most 5 meters (depends on configuration). Linux supports the bus, although not all devices that @@ -5069,19 +5032,13 @@ kernel/drivers/usb/serial. It would be nice to have a HOWTO on the USB. See also <url url="http://www.linux-usb.org"> and/or <url url="http://.www.qbik.ch/usb/">. -<sect1> IEEE 1394 (Firewire) -<p>IEEE 1394 is something like USB only almost twice as fast at 800 -Mbps. The protocol on the bus is claimed to be more efficient than -USB's. It uses two twisted pair for data plus two power conductors (6 -conductors in all). A variants uses only 4 conductors. You may -compile 1394 support into the Linux kernel. Like USB, it's also -limited to short distances. - -<sect1>Ethernet -<p>This started out at 10Mb/sec, then went to 100Mb/sec and then to -1Gb/sec (gigabit ethernet). It too uses twisted pair cable or it can -be wireless and use radio waves. It also uses serial transmission of -data and can be used over long cables, unlike USB and analog serial. +<sect1> Firewire +<p> Firewire (IEEE 1394) is something like the USB only faster (800 +Mbps is planned). The protocol on the bus is claimed to be more +efficient than USB's. It uses two twisted pair for data plus two +power conductors (6 conductors in all). A variants uses only 4 +conductors. You may compile firewire support into the Linux kernel. +Like USB, it's also limited to short distances. <sect1> MIDI <p>Sound cards often have a 15-pin game port connector used for MIDI. @@ -5257,7 +5214,12 @@ meaning of "stty" commands, etc. <itemize> <item> <url url="http://serial.sourceforge.net/" name="Linux Serial Driver home page"> Includes info about PCI support. - +<!-- +<item> <label id="vern_"> Serial Suite by + Vern Hoxie was a collection of blurbs about the + care and feeding of the Linux serial port plus some simple programs. + Not available. +--> <item> <label id="vern_"> Serial-Programming-HOWTO (not yet available from the Linux Documentation Project). It's now on my website: <url @@ -5265,13 +5227,12 @@ url="http://www.lafn.org/~dave/linux/Serial-Programming-HOWTO.txt"> See also: <url url="http://www.lafn.org/~dave/linux/Serial-Programming-HOWTO-B.txt" name="Serial-Programming-HOWTO by Peter Baumann"> -<label id="verns_serial_HT"> <item> <url url="http://www.lafn.org/~dave/linux/terminalIO.html" name="Terminal IO by Vern Hoxie"> <url url="http://www.lafn.org/~dave/linux/termios.txt" name="Termios man -page revision by Vern Hoxie"> +page revision by Vern Hoxie"> <item> A white paper discussing serial communications and multiport serial boards was available from Cyclades at <tt><htmlurl @@ -5282,7 +5243,7 @@ url="http://www.freebsd.org/doc/en_US.ISO8859-1/articles/serial-uart/" name="Serial and UART Tutorial (FreeBSD)"> </itemize> -<sect> Appendix A: Obsolete Hardware/Software +<sect> Appendix A: Very Obsolete Hardware/Software <sect1>Replacing pre 1990 UARTS <p> Many 486 PCs (old) and all Pentiums (or the like) should have @@ -5309,9 +5270,9 @@ use the same IO address. See <ref id="probing_ss" name="Probing">. <sect1>Configuring by modifying source code <p>In the past, to get a certain serial port supported, one might need to modify the C source code, perhaps by adding a #define to it. -Today, the use modules for multiport cards, use of parameters for -modules or the kernel, or the use of configuration options should -handle all cases. +Today, the use of parameters for modules or the kernel, or the use of +configuration options should handle all cases (except possible for +antique hardware ??). <sect1> Modems on Multiport Cards Obsolete for Sending at 56k <p>For a modem to transmit at nearly 56k requires that it be a special @@ -5323,7 +5284,7 @@ are obsolete unless one doesn't need to send at 56k. In other words they are obsolete for ISP servers but might be OK for small business or home use. -An partial exception to the above are modem banks that connect to +A partial exception to the above are modem banks that connect to multiport serial cards where the modem bank can access multiplexed digital phone lines. Thus one could use a multiport serial card with a few 56k digital modems for sending at 56k. For both analog and