Linux Serial HOWTO (part 1/2)

Linux Serial HOWTO (part 1/2)

Post by Greg Hankin » Tue, 04 Jul 1995 04:00:00

Archive-name: linux/howto/serial/part1
Last-modified: 2 Jul 95


*** The Linux Serial HOWTO is posted automatically by the Linux
*** HOWTO coordinator, Greg Hankins <>.  Please
*** direct any comments or questions about this HOWTO to the author,
*** Greg Hankins <>.

- --- BEGIN Linux Serial HOWTO part 1/2 ---

  The Linux Serial HOWTO
  by Greg Hankins,
  v1.8a, 5 June 1995

  This document describes how to set up serial communications devices
  on a Linux box.

  1.  Introduction

  This is the Linux Serial HOWTO.  All about how to set up modems and
  terminals under Linux, some serial tips, and troubleshooting.

  1.1.  Copyright

  The Linux Serial HOWTO is copyright (C) 1993 - 1995 by Greg Hankins.
  Linux HOWTO documents may be reproduced and distributed in whole or in
  part, in any medium physical or electronic, as long as this copyright
  notice is retained on all copies. Commercial redistribution is allowed
  and encouraged; however, the author would like to be notified of any
  such distributions.

  All translations, derivative works, or aggregate works incorporating
  any Linux HOWTO documents must be covered under this copyright notice.
  That is, you may not produce a derivative work from a HOWTO and impose
  additional restrictions on its distribution. Exceptions to these rules
  may be granted under certain conditions; please contact the Linux
  HOWTO coordinator at the address given below.

  In short, we wish to promote dissemination of this information through
  as many channels as possible. However, we do wish to retain copyright
  on the HOWTO documents, and would like to be notified of any plans to
  redistribute the HOWTOs.

  If you have questions, please contact Greg Hankins, the Linux HOWTO
  coordinator, at via email, or at +1 404 853 9989.

  1.2.  Other sources of information

  o  man pages for: agetty(8), getty(1m), gettydefs(5), init(1),
     login(1), mgetty(8), setserial(8)

  o  Your modem manual

  o  UUCP HOWTO: for information on setting up UUCP

  o  Printing HOWTO: for setting up a serial printer

  o  NET-2 HOWTO: all about networking, including SLIP, CSLIP, PLIP and

  o  BUPS HOWTO: setting up UPS boxen connected to your serial port

  o  Term HOWTO: everything you wanted to know about the term program

  o  USENET newsgroups:

  comp.os.linux.advocacy            Benefits of Linux compared to other operating systems.
  comp.os.linux.announce            Announcements important to the Linux community.
  comp.os.linux.answers             FAQs, How-To's, READMEs, etc. about Linux.
  comp.os.linux.development.apps    Writing Linux applications, porting to Linux.
  comp.os.linux.development.system  Linux kernels, device drivers, modules.
  comp.os.linux.hardware            Hardware compatibility with the Linux operating system.
  comp.os.linux.misc                Linux-specific topics not covered by other groups.
  comp.os.linux.networking          Networking and communications under Linux.
  comp.os.linux.setup               Linux installation and system administration.
  comp.os.linux.x                   Linux X Window System servers, clients, libs and fonts.

  o  the Linux serial mailing list.  To join, send email to, with

     ``subscribe linux-serial'' in the message body.  If you send
     ``help'' in the message body, you get a help message.

  1.3.  New versions of this document

  New versions of the Serial-HOWTO will be placed on (
  HOWTO) and mirror sites.  There are other formats, such as a
  PostScript and dvi version in the other-formats directory.  The Serial
  HOWTO ( is also
  available for WWW clients such as mosaic.  It will also be posted
  regularly to comp.os.linux.answers.

  If you don't have FTP access, you can get Linux help files via email.
  Bill Riemers runs a mail handler on his account.  Send mail to with a subject of ``help'' for more infomation,
  and to get an index file.

  1.4.  Feedback

  Please send me any questions, comments, suggestions, or additional
  material.  I'm always eager to hear about what you think about the
  HOWTO.  I'm also always on the lookout for improvements!  Tell me
  exactly what you don't understand, or what could be clearer.  You can
  reach me at via email.  I can also be
  reached at:

  Greg Hankins

  College of Computing

  801 Atlantic Drive

  Atlanta, GA 30332-0280

  via snail mail, and at my home page
  ( via the WWW.

  Please include the version number of the Serial HOWTO when writing,
  this is version 1.8a.

  1.5.  Disclaimer

  Your milage may vary.  The answers given may not work for all systems
  and all setup combinations.

  2.  Supported serial hardware

  Linux is known to work with the following serial hardware.

  o  standard PC serial boards (COM1 - COM4), to which external serial
     devices (modems, serial mice, etc...) can be connected

  o  standard PC internal modems (COM1 - COM4)

  o  Quickpath Systems Port-Folio 550e (allows IRQs of 3, 4, 5, 9, 10,
     11, 12, and 15)

  2.1.  Multiport serial boards (with 16450/16550A UARTs)

  o  AST FourPort and clones (4 port)

  o  Accent Async-4 (4 port)

  o  Arnet Multiport-8 (8 port)

  o  Bell Technologies HUB6 (6 port)

  o  Boca BB-1004 (4 port), BB-1008 (8 port), BB-2016 (16 port)

  o  Boca IOAT66 (6 port)

  o  Boca 2by4 (4S/2P)

  o  Computone ValuePort V4-ISA (AST FourPort compatible)

  o  PC-COMM (4 port)

  o  STB-4COM (4 port)

  o  Twincom ACI/550

  o  Usenet Serial Board II (4 port)

  In general, Linux will support any serial board which uses a 8250,
  16450, 16550, 16550A (or compatible) UART, or an internal modem which
  emulates one of the above UARTs.

  Special note on the BB-1004 and BB-1008, they do not support DCD and
  RI lines, and thus are not usable for dialin modems.  They will work
  fine for all other purposes.

  2.2.  Intelligent multiport serial boards

  o  Comtrol RocketPort (36Mhz ASIC - 4, 8, 16 or 32 port) (contact or Comtrol's Home Page (
     Driver location:
  o  Computone IntelliPort II (16Mhz 80186 - 4, 8, or 16 port) Computone
     IntelliPort II EXpandable (20Mhz 80186 - modular 16 - 64 port)
     (pre-ALPHA driver, contact Michael H. Warfield,

  o  Cyclades Cyclom 8Y (8 port), and 16Y (16 port) (Cirrus Logic
     CD-1400 RISC UARTs) (contact

  o  DigiBoard PC/Xe (12.5MHz 80186 processor - 2, 4, 8, or 16 port),
     and PC/Xi (12.5MHz 80186 processor - 8, or 16 port) (contact Troy
     De Jongh,  Driver location:

  o  Digiboard COM/Xi (10MHz 80188 processor - 4 or 8 port)

     (pre-ALPHA driver contact Simon Park,

  o  Hayes ESP8 (8 port)

     (pre-ALPHA driver, contact Dennis Boylan,

  o  Omega COMM-8 (8 port)

     (contact Vance Petree,

  o  Specialix SIO - (modular, 4 - 32 port)

     (ALPHA driver, contact Simon Allen,

  o  Stallion EasyIO-4 (4 port), EasyIO-8 (8 port), and Stallion
     EasyConnection (modular, 8 - 32 port) (Cirrus Logic CD-1400 RISC
     UARTs) (contact Greg Ungerer,

  Drivers for the Cyclades, DigiBoard, Stallion and Specialix boards can

  found on and mirror

  3.  What are the names of the serial ports?

  There are the 4 serial devices corresponding to COM1 - COM4:

       /dev/cua0, /dev/ttyS0 (COM1) address 0x3f8 IRQ 4
       /dev/cua1, /dev/ttyS1 (COM2) address 0x2f8 IRQ 3
       /dev/cua2, /dev/ttyS2 (COM3) address 0x3e8 IRQ 4
       /dev/cua3, /dev/ttyS3 (COM4) address 0x2e8 IRQ 3

  The /dev/ttySN devices are for incoming connections and /dev/cuaN
  devices for outgoing connections.  N is the serial port number.  In
  this document, I refer to COM1 as ttyS0, COM2 as ttyS1, COM3 as ttyS2,
  and COM4 as ttyS3.  If I am refering to a specific device in /dev, I
  will always prepend /dev to avoid confusing you.

  On some installations, two extra devices will be created, /dev/modem
  for your modem and /dev/mouse for your mouse.  Both of these are
  symbolic links to the appropriate /dev/cuaN device which you specified
  during the installation (unless you have a bus mouse, then /dev/mouse
  will point to the bus mouse device).

  There has been some discussion on the merits of /dev/mouse and
  /dev/modem.  I strongly discourage the use of these links.  In
  particular, if you are planning on using your modem for dialin you
  will run into problems because the lock files will not work correctly
  if you use /dev/modem. Use them if you like, but be sure they point to
  the right device.

  3.1.  Major and minor device numbers of serial devices in /dev

       /dev/ttyS0 major 4, minor 64    /dev/cua0 major 5, minor 64
       /dev/ttyS1 major 4, minor 65    /dev/cua1 major 5, minor 65
       /dev/ttyS2 major 4, minor 66    /dev/cua2 major 5, minor 66
       /dev/ttyS3 major 4, minor 67    /dev/cua3 major 5, minor 67

  Note that all distributions should come with these devices already
  made correctly.

  3.1.1.  Creating devices in /dev

  If you don't have a device, you will have to create it with the mknod

  Example, suppose you needed to create devices for ttyS0:

       linux# mknod -m 666 /dev/cua0 c 5 64
       linux# mknod -m 666 /dev/ttyS0 c 4 64

  You can also get the MAKEDEV script, available on the usual FTP sites.

read more »


Linux Serial HOWTO (part 1/2)

Post by Greg Hankin » Tue, 04 Jul 1995 04:00:00

Archive-name: linux/howto/serial/part2
Last-modified: 2 Jul 95


*** The Linux Serial HOWTO is posted automatically by the Linux
*** HOWTO coordinator, Greg Hankins <>.  Please
*** direct any comments or questions about this HOWTO to the author,
*** Greg Hankins <>.

- --- BEGIN Linux Serial HOWTO part 2/2 ---

  The UART itself can't do anything with the data, it just sends and
  receives it.  The CPU gets an interrupt from the serial device every
  time a byte has been sent or received.  The CPU then moves the
  received byte out of the UART's buffer and into memory somewhere, or
  gives the UART another byte to send. The 8250 and 16450 UARTs only
  have a 1 byte buffer.  That means, that every time 1 byte is sent or
  received, the CPU is interrupted.  At low rates, this is OK.  But, at
  high transfer rates, the CPU gets so busy dealing with the UART, that
  is doesn't have time to tend to other tasks.  In some cases, the CPU
  does not get around to servicing the interrupt in time, and the byte
  is overwritten, because they are coming in so fast.

  That's where the 16550A UARTs are useful.  These chips come with 16
  byte FIFOs.  This means that it can receive or transmit up to 16 bytes
  before it has to interrupt the CPU.  Not only can it wait, but the CPU
  then can transfer all 16 bytes at a time.  Although the interrupt
  threshold is seldom set at 16, this is still a significant advantage
  over the other UARTs, which only have the 1 byte buffer.  The CPU
  receives less interrupts, and is free to do other things.  Data is not
  lost, and everyone is happy.  (There is also a 16550 UART, but it is
  treated as a 16450)

  In general, the 8250 and 16450 UARTs should be fine for speeds up to
  38400 bps.  At speeds greater than 38400 bps, you might start seeing
  data loss, and a reduction in interactive response time.  Other PC
  operating systems (definition used loosely here), like DOS aren't
  multitasking, so they might be able to cope better with 8250 or
  16450s.  That's why some people don't see data loss, until they switch
  to Linux.

  Non-UART, and intelligent multiport boards use DSP chips to do
  additional buffering and control, thus relieving the CPU even more.
  For example, the Cyclades Cyclom, and Stallion EasyIO boards use a
  Cirrus Logic CD-1400 RISC chip.

  Keep in mind that these dumb UART types are not bad, they just aren't
  good for high speeds.  You should have no problem connecting a
  terminal, or a mouse to these UARTs.  But, for a high speed modem, the
  16550A is definately a must.

  You can buy serial cards with the 16550A UARTs for a little more
  money, just ask your dealer what type of UART is on the card.  Or if
  you want to upgrade your existing card, you can simply purchase 16550A
  chips and replace your existing 16450 UARTs.  They are pin-to-pin
  compatible.  Some cards come with socketed UARTs for this purpose, if
  not you can solder.  Note, that you'll probably save yourself a lot of
  trouble by just getting a new card, if you've got the money, they are
  under US$ 50.

  14.4.  /dev/ttySN devices?  What's the real difference between the
  /dev/cuaN and

  The only difference is the way that the devices are opened.  The
  dialin devices /dev/ttySN are opened in blocking mode, until CD is
  asserted (ie someone connects).  So, when someone wants to use a
  /dev/cuaN device, there is no conflict with a program watching the
  /dev/ttySN device.

  The distinction is made to allow dialin and dialout use of the same
  serial port.

  15.  Troubleshooting

  15.1.  I keep getting ``line NNN of inittab invalid''.

  Make sure you are using the correct syntax for your version of init.
  The different init's that are out there use different syntax in the
  /etc/inittab file.  Make sure you are using the correct syntax for
  your version of getty.

  15.2.  When I try to dial out, it says ``/dev/cuaN: Device or resource

  This problem can arise when DCD or DTR are not set correctly.  DCD
  should only be set when there is an actual connection (ie someone is
  dialed in), not when getty is watching the port.  Check to make sure
  that your modem is configured to only set DCD when there is a
  connection.  DTR should be set whenever something is using, or
  watching the line, like getty, kermit, or some other comm program.

  Another common cause of ``device busy'' errors, is that you set up
  your serial port with an interrupt already taken by something else.
  As each device initializes, it asks Linux for permission to use its
  hardware interrupt.  Linux keeps track of which interrupt is assigned
  to whom, and if your interrupt is already taken, your device won't be
  able to initialize properly.  The device really doesn't have much of
  any way to tell you that this happened, except that when you try to
  use it, it will return a ``device-busy'' error.  Check the interrupts
  on all of your cards (serial, ethernet, SCSI, etc.).  Look for IRQ

  15.3.  I keep getting ``Id SN respawning too fast: disabled for 5 min-

  Make sure your modem is configured correctly.  Look at registers E and
  Q.  This can occur when your modem is chatting with getty.

  Make sure you are calling getty correctly from your /etc/inittab.
  Using the wrong syntax or device names will cause serious problems.

  This can also happen when the uugetty initialization is failing.  Go
  to the ``getty or uugetty still doesn't work'' question.

  15.4.  Serial devices are slow or serial devices can only send in one

  You probably have an IRQ conflict.  Make sure there are no IRQs being
  shared.  Check all your cards (serial, ethernet, SCSI, etc...).  Make
  sure the jumper settings, and the setserial parameters are correct for
  all your serial devices.

  15.5.  respawn.  My modem is hosed after someone hangs up, or uugetty

  This can happen when your modem doesn't reset when DTR is dropped.  I
  saw my RD and SD LEDs go nuts when this happened to me.  You need to
  have your modem reset.  Most Hayes compatible modems do this with &D3,
  but on my USR Courier, I had to set &D2 and S13=1.  Check your modem

  15.6.  it just locks up.  I have my terminal connected to my PC, but
  after I type in a login name,

  You probably don't have CLOCAL in your /etc/gettydefs entry for the
  terminal, and you're probably not using a full null modem cable.  You
  need CLOCAL,  which tells Linux to ignore modem control signals.  Here
  is what it should look like:

       # 38400 bps Dumb Terminal entry
       DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400
       # 19200 bps Dumb Terminal entry
       DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200
       # 9600 bps Dumb Terminal entry
       DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600

  Next, kill the getty process so a new one will be spawned with the new

  15.7.  At high speeds, my modem loses data.

  If you are trying to run your modem at > 19200 bps, and you don't have
  16550A UARTs, you should upgrade them.  See section ``What are
  UARTs?'' about UARTs.

  15.8.  them configured.  On startup, Linux doesn't report the serial
  devices the way I have

  This is true.  Linux does not do any IRQ detection on startup, 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.

  So, even though I have my ttyS2 set at IRQ 5, I still see

       Jan 23 22:25:28 misfits vmunix: tty02 at 0x03e8 (irq = 4) is a 16550A

  You have to use setserial to tell Linux the IRQ you are using.

  15.9.  rz and/or sz don't work when I call my Linux box on my modem.

  If Linux looks for /dev/modem when you try to transfer files, look at
  /etc/profile, and /etc/csh.cshrc.  There are a bunch of aliases
  defined there on some distributions, most notably Slackware.  These
  aliases mess up the zmodem programs.  Take them out, or correct them.

  15.10.  My screen is printing funny looking characters.

  This happens on virtual consoles when you send binary data to your
  screen, or sometimes on serial connections.  The way to fix this is to
  type echo ^v^[c.  For the control-character-impaired, thats echo

  15.11.  getty or uugetty still doesn't work.

  There is a DEBUG option that comes with getty_ps.  Edit your config
  file /etc/conf.{uu}getty.ttySN and add DEBUG=NNN.  Where NNN is one of
  the following combination of numbers according to what you are trying
  to debug:

  D_OPT   001            option settings
  D_DEF   002            defaults file processing
  D_UTMP  004            utmp/wtmp processing
  D_INIT  010            line initialization (INIT)
  D_GTAB  020            gettytab file processing
  D_RUN   040            other runtime diagnostics
  D_RB    100            ringback debugging
  D_LOCK  200            uugetty lockfile processing
  D_SCH   400            schedule processing
  D_ALL   777            everything

  Setting DEBUG=010 is a good place to start.

  If you are running syslogd, debugging info will appear in your log
  files.  If you aren't running syslogd info will appear in
  /tmp/getty:ttySN for debugging getty and /tmp/uugetty:ttySN for
  uugetty, and in /var/adm/getty.log.  Look at the debugging info and
  see what is going on.  Most likely, you will need to tune some of the
  parameters in your config file, and reconfigure your modem.

  You could also try mgetty.  Some people have better luck with it.

  16.  Contributions

  There was no possible way to write this HOWTO alone.  Although a lot
  of the HOWTO is my writing, I have rewritten many contributions to

read more »