Linux/Serial

From Omnia
Revision as of 04:28, 25 May 2017 by Kenneth (talk | contribs) (→‎minicom)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Serial

serial port settings

Show serial port details:

]# setserial -g /dev/ttyS*
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
]# setserial -ga /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test
]# setserial -gb /dev/ttyS0
/dev/ttyS0 at 0x03f8 (irq = 4) is a 16550A
]# setserial -gG /dev/ttyS0
/dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test

Set serial port details: Serial HOWTO: Interesting Programs You Should Know About

/sbin/setserial /dev/ttyS3 irq 5 uart 16550A  skip_test
/sbin/setserial /dev/ttyS3 auto_irq skip_test autoconfig

serial line speed

Set serial speed to 9600: [1]

]# stty -F /dev/ttyS0 9600
]# stty -F /dev/ttyS0 115200

Show serial speed:

]# stty -F /dev/ttyS0
speed 9600 baud; line = 0;

uucp

Use uucp [2]:

yum install uucp
cu -l ttyS0 -s 9600

cu hotkey:

~[COMMAND]
~?  # help
~.  # hangup

cu commands:

[Escape sequences]
[~. hangup]                   [~!CMD run shell]
[~$CMD stdout to remote]      [~|CMD stdin from remote]
[~+CMD stdin and stdout to remote]
[~# send break]               [~cDIR change directory]
[~> send file]                [~< receive file]
[~pFROM TO send to Unix]      [~tFROM TO receive from Unix]
[~sVAR VAL set variable]      [~sVAR set boolean]
[~s!VAR unset boolean]        [~v list variables]
[~z suspend]
[~%break send break]         [~%cd DIR change directory]
[~%put FROM TO send file]    [~%take FROM TO receive file]
[~%nostop no XON/XOFF]       [~%stop use XON/XOFF]

"Once in a 'cu' session, you can issue instructions using the ~ character, followed by another character specifying the actual command. For a complete list of commands, use ~?" [3]

minicom

See minicom

notes

Linux Online - Modem-HOWTO: Configuring the Serial Driver (high-level) "stty"

  • Normally the port is set by the communications program at 8N1 (8-bits per byte, No parity, and 1 stop bit)

Show serial device info: [4]stty

setserial -a /dev/ttyS3

Linux Serial Console HOWTO


Serial HOWTO:

"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. "


RS-232 Cable Is Low Speed & Short Distance:

"The conventional RS-232 serial port is inherently low speed and is severely limited in distance. Ads used to 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 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 faster. Twisted pairs have been used in telephone cables since the late 1800's. In 1888 (over 120 years ago) the "Cable Conference" reported its support of twisted-pair (for telephone systems) and pointed out its advantages. But over 80 years after this approval by the "Cable Conference", RS-232 failed to utilize it. Since RS-232 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."



Linux Serial Programming:



  • minicom - telix-like communications program
  • picocom - like a small minicom but no automatic phone dialing
  • gtkterm - a simple gtk terminal, X-based
  • seyon - X based communication program
  • xc - xcomm communication package


Linux as a serial terminal


Linux Serial Console HOWTO

Resources


Tiny serial terminal



LavaLink Eight Port Serial Card

8-Port DB-9Pin RS-232 Serial PCI Controller Card (0192) - $39.95 : era-ele:

Specification & Features:

  • CHIPS: ITE8871
  • PCI 32-Bit 33MHz Interface
  • Compliant with PCI Specification Revision 2.1
  • Support PCI Bus-Master Access
  • Fully Plug & Play compatible
  • Compatible with Standard 16C550 UART with 16-Byte Transmit-Receive FIFO
  • Fast data rates up to 1-MBytes/Sec
  • Driver supported MS Windows 98SE/ME/2000/XP/NT4.0 Server 2003/XP 64-bit/Vista, Linux, DOS


Serial/Parallel : era-ele

"PCI/PCI-X/PCI-Express/Expresscard/PCMCIA Cardbus/USB converter to RS-232/RS-485/RS-422, Serial, Parallel"


New SIIG 4 Port PCI serial card (16C954) driver problem - LinuxQuestions.org:

"I have installed a new SIIG Quartet Serial 550 PCI card and cannot get it to work correctly."


LAVA: Start - HQ-ST Plus - LAVA Computer MFG

PCI 8 port RS-232 w. cable:

"Eight Port Serial Card (PCI Bus 16550)
The LAVA Octopus-550 provides the easiest way to add eight 16550 UART serial ports to a PC system while using only one system IRQ!
This eight-port board is one of the most dependable multi-port serial cards around. It is an ideal communications solution in an ISP or remote access system environment. The Octopus-550 is also popular in Point-of-Sale systems, where it is a very cost-effective alternative to many other eight-port boards on the market."

Installing an Octopus-550 in Linux

On install during the bootup process, the Linux hardware discovery utility detects the Octopus-550 and installs it as ttyS4 ,ttyS5, ttyS6, ttyS7, ttyS8, ttyS9, ttyS10, and ttyS11. These settings will change depending on how many serial ports you have and how they are configured.

However, on installation the card will be configured incorrectly. To configure the card correctly, first find out the port information (I/O range and IRQ) for each serial port. To retrieve that information type at the command line:

lspci -v

You will then see two separate entries for a “Serial Controller: Lava Computer MFG”. Below each entry will be a IRQ number and four I/O ports. Write down that information for all ports (for example, IRQ 12, a400, a800, ac00, b000 IRQ 12, b400, b800, bc00, c000).

Then edit the file:

/etc/rc.d/rc.local

Add the following lines at the end of the file:

setserial /dev/ttyS4 port 0xa400 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS5 port 0xa800 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS6 port 0xac00 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS7 port 0xb000 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS8 port 0xb400 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS9 port 0xb800 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS10 port 0xbc00 irq 12 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS11 port 0xc000 irq 12 uart 16550a baud_base 115200 ^fourport

The example above uses the information gained from the lspci -v command. The details of your information may be different. Be sure to save the added changes. On reboot all of the ports should be operational.


References:

Lava Notes

01:07.0 Serial controller: Lava Computer mfg Inc Lava Octo A (rev 03)
01:07.1 Serial controller: Lava Computer mfg Inc Lava Octo B (rev 03)



01:07.0 Serial controller: Lava Computer mfg Inc Lava Octo A (rev 03) (prog-if 02 [16550])
        Subsystem: Lava Computer mfg Inc Lava Octo A
        Flags: medium devsel, IRQ 217
        I/O ports at ac00 [size=8]
        I/O ports at a800 [size=8]
        I/O ports at a400 [size=8]
        I/O ports at a000 [size=8]

01:07.1 Serial controller: Lava Computer mfg Inc Lava Octo B (rev 03) (prog-if 02 [16550])
        Subsystem: Lava Computer mfg Inc Lava Octo B
        Flags: medium devsel, IRQ 217
        I/O ports at 9c00 [size=8]
        I/O ports at 9800 [size=8]
        I/O ports at 9400 [size=8]
        I/O ports at 9000 [size=8]



/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0xac00, IRQ: 217
/dev/ttyS2, UART: 16550A, Port: 0xa800, IRQ: 217
/dev/ttyS3, UART: 16550A, Port: 0xa400, IRQ: 217


crw-rw---- 1 0 14 4, 64 Mar 21 12:19 /dev/ttyS0
crw-rw---- 1 0 14 4, 65 Mar 21 14:51 /dev/ttyS1
crw-rw---- 1 0 14 4, 66 Mar 21 14:53 /dev/ttyS2
crw-rw---- 1 0 14 4, 67 Mar 21 14:54 /dev/ttyS3

ttyS0 4, 64

mknod -m 666 /dev/ttyS5 c 4 69
mknod -m 666 /dev/ttyS6 c 4 70
mknod -m 666 /dev/ttyS7 c 4 71
mknod -m 666 /dev/ttyS8 c 4 72

setserial /dev/ttyS4 port 0xac00 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS5 port 0xa800 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS6 port 0xa400 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS7 port 0xa000 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS8 port 0x9c00 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS9 port 0x9800 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS10 port 0x9c00 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS11 port 0x9000 irq 217 uart 16550a baud_base 115200 ^fourport

setserial /dev/ttyS1 port 0xa400 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS8 port 0x9c00 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS9 port 0x9800 irq 217 uart 16550a baud_base 115200 ^fourport
setserial /dev/ttyS10 port 0x9400 irq 217 uart 16550a baud_base 115200 ^fourport

ttyS1 dbridge-prod-pix
ttyS2 vpn
ttyS3
ttyS4
8 - dbridge-admin-pix
10 - vpn


kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ nr_uarts=16 8250.nr_uarts=16



/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS10, UART: 16550A, Port: 0x9400, IRQ: 217
/dev/ttyS11, UART: 16550A, Port: 0x9000, IRQ: 217
/dev/ttyS12, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS13, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS14, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS15, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
/dev/ttyS4, UART: 16550A, Port: 0xac00, IRQ: 217
/dev/ttyS5, UART: 16550A, Port: 0xa800, IRQ: 217
/dev/ttyS6, UART: 16550A, Port: 0xa400, IRQ: 217
/dev/ttyS7, UART: 16550A, Port: 0xa000, IRQ: 217
/dev/ttyS8, UART: 16550A, Port: 0x9c00, IRQ: 217
/dev/ttyS9, UART: 16550A, Port: 0x9800, IRQ: 217





[root@serial ~]# stty -F /dev/ttyS0
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS1
stty: /dev/ttyS1: Input/output error
[root@serial ~]# stty -F /dev/ttyS2
stty: /dev/ttyS2: Input/output error
[root@serial ~]# stty -F /dev/ttyS3
stty: /dev/ttyS3: Input/output error
[root@serial ~]# stty -F /dev/ttyS4
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS5
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS6
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS7
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS8
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS9
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS10
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS11
speed 9600 baud; line = 0;
-brkint -imaxbel
[root@serial ~]# stty -F /dev/ttyS12
stty: /dev/ttyS12: Input/output error
[root@serial ~]# stty -F /dev/ttyS13
stty: /dev/ttyS13: Input/output error
[root@serial ~]# stty -F /dev/ttyS14
stty: /dev/ttyS14: Input/output error
[root@serial ~]# stty -F /dev/ttyS15
stty: /dev/ttyS15: Input/output error
[root@serial ~]# stty -F /dev/ttyS16
stty: /dev/ttyS16: No such file or directory




[root@serial ~]# setserial -g /dev/ttyS*
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS10, UART: 16550A, Port: 0x9400, IRQ: 217
/dev/ttyS11, UART: 16550A, Port: 0x9000, IRQ: 217
/dev/ttyS12, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS13, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS14, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS15, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
/dev/ttyS4, UART: 16550A, Port: 0xac00, IRQ: 217
/dev/ttyS5, UART: 16550A, Port: 0xa800, IRQ: 217
/dev/ttyS6, UART: 16550A, Port: 0xa400, IRQ: 217
/dev/ttyS7, UART: 16550A, Port: 0xa000, IRQ: 217
/dev/ttyS8, UART: 16550A, Port: 0x9c00, IRQ: 217
/dev/ttyS9, UART: 16550A, Port: 0x9800, IRQ: 217



[root@serial ~]# setserial -a -v /dev/ttyS4
/dev/ttyS4, Line 4, UART: 16550A, Port: 0xac00, IRQ: 217
        Baud_base: 460800, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test



[root@serial ~]# setserial -g -G -v /dev/ttyS*
/dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test
/dev/ttyS1 uart unknown port 0x02f8 irq 3 baud_base 115200 spd_normal skip_test auto_irq
/dev/ttyS10 uart 16550A port 0x9400 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS11 uart 16550A port 0x9000 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS12 uart unknown port 0x0000 irq 0 baud_base 0 spd_normal
/dev/ttyS13 uart unknown port 0x0000 irq 0 baud_base 0 spd_normal
/dev/ttyS14 uart unknown port 0x0000 irq 0 baud_base 0 spd_normal
/dev/ttyS15 uart unknown port 0x0000 irq 0 baud_base 0 spd_normal
/dev/ttyS2 uart unknown port 0x03e8 irq 4 baud_base 115200 spd_normal skip_test auto_irq
/dev/ttyS3 uart unknown port 0x02e8 irq 3 baud_base 115200 spd_normal auto_irq
/dev/ttyS4 uart 16550A port 0xac00 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS5 uart 16550A port 0xa800 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS6 uart 16550A port 0xa400 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS7 uart 16550A port 0xa000 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS8 uart 16550A port 0x9c00 irq 217 baud_base 460800 spd_normal skip_test
/dev/ttyS9 uart 16550A port 0x9800 irq 217 baud_base 460800 spd_normal skip_test






setserial /dev/ttyS4 uart 16550A port 0xac00 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS5 uart 16550A port 0xa800 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS6 uart 16550A port 0xa400 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS7 uart 16550A port 0xa000 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS8 uart 16550A port 0x9c00 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS9 uart 16550A port 0x9800 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS10 uart 16550A port 0x9400 irq 217 baud_base 115200 ^fourport
setserial /dev/ttyS11 uart 16550A port 0x9000 irq 217 baud_base 115200 ^fourport

Serial To Read

Newegg.com - LAVA Computer 8 Port Serial Card (PCI Bus 16550) Model OCTOPUS-550 - Add-On Cards:

"Adds eight high-speed 16550 UART serial COM ports to any PCI-equipped PC
Serial ports support up to 115.2 kbps throughput rate
All eight ports require only one system IRQ
Automatically selects next available IRQ and COM addresses
Carries the standard pin-out for serial ports
Easy Plug and Play installation
Includes octopus cable with eight
DB-9 connectors
Includes Lava Com Port Redirect Utility for renaming COM Ports in Windows 95/98/Me.
Allows for backward compatibility with software that supports COM 1-4 only"

mars - CAL Network - Trac:

"mars also has a Lava Octopus-550 8-port RS232 PCI card."


Serial HOWTO - David S.Lawyer dave@lafn.org original by Greg Hankins:

"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."

Accessing Serial Devices:

"Like all devices in a Unix system, serial ports are accessed through device special files, located in the /dev directory. There are two varieties of device files related to serial drivers, and there is one device file of each type for each port. The device will behave slightly differently, depending on which of its device files we open. We'll cover the differences because it will help you understand some of the configurations and advice that you might see relating to serial devices, but in practice you need to use only one of these. At some point in the future, one of them may even disappear completely."

Linux Online - Serial HOWTO: Serial Port Devices /dev/tts/2 = /dev/ttyS2, etc.:

"Once upon a time the names of the serial ports were simple. Except for some multiport serial cards they were named /dev/ttyS0, /dev/ttyS1, etc. Then around the year 2000 came the USB bus with names like /dev/ttyUSB0 and /dev/ttyACM1 (for the ACM modem on the USB bus)."

Linux Online - Text-Terminal-HOWTO: Terminal Special Files such as /dev/tty:

""tty" is an abbreviation for "Teletype". The first terminals were Teletypes (like remotely controlled typewriters). See subsection Teletypes. A list of Linux devices (the stuff in the /dev directory) may be found in "Linux Allocated Devices" which should be included with kernel sources. It "describes" what each device used for in only a word or two but doesn't tell you how to use them."

Linux Online - Serial HOWTO: Multiport Serial Boards/Cards/Adapters:

"Multiport serial cards install in slots in a PC on the ISA or PCI bus. They are also called "... adapters" or "... boards". Each such card provides you with many serial ports. Today they are commonly used for the control of external devices (including automation for 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 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."

Linux Online - Modem-HOWTO: Serial Port Devices /dev/ttyS4, (or /dev/ttys/4) etc.:

"Once upon a time the names of the serial ports were simple. Except for some multiport serial cards they were named /dev/ttyS0, /dev/ttyS1, etc. Then around the year 2000 came the USB bus with names like /dev/ttyUSB0 and /dev/ttyACM1 (for the ACM modem on the USB bus)."

Linux Serial Console HOWTO:

"Have you ever needed to connect a dumb terminal (like a Wyse 50) to a Linux host? Do you need to login to a Linux server from a laptop to perform administrative functions, because there is no monitor or keyboard attached to the server? If you are accustomed to administering routers, switches, or firewalls in this manner, then you may be interested in doing the same with some of your GNU/Linux hosts. This HOWTO will explain, step-by-step, how to setup a serial console for Red Hat 9, although most of it should apply to other distributions as well."

Serial Programming/Serial Linux - Wikibooks, collection of open-content textbooks:

"This Wikibooks:module talks about the classic Unix C APIs for controlling serial devices. Languages other than C might provide appropriate wrappers to these APIs which look similar, or come with their own abstraction (e.g.Java). Nevertheless, these APIs are the lowest level of abstraction one can find for serial I/O in Unix. And, in fact they are also the highest abstraction in C on standard Unix. Some Unix versions ship additional vendor-specific proprietary high-level APIs. These APIs are not discussed here.
Actual implementations of classic Unix serial APIs do vary in practice, due to the different versions of Unix and its clones, like Linux. Therefore, this module just provides a general outline. It is highly recommended that you study a particular Unix version's manual (man pages) when programming for a serial device in Unix. The relevant man pages are not too great a read, but they are usually complete in their listing of options and parameters. Together with this overview it should be possible to implement programs doing serial I/O under Unix."

Serial Programming HOWTO:

"This is the Linux Serial Programming HOWTO. All about how to program communications with other devices / computers over a serial line under Linux. Different techniques are explained: Canonical I/O (only complete lines are transmitted/received), asyncronous I/O, and waiting for input from multiple sources. "

Using Serial Consoles - (Solaris / Linux):

"The following article documents some of the tips for connecting the serial port of a UNIX Server (Sun SPARC / Linux) to the serial port (console) of a Sun Server. This is often helpful and even necessary when performing routine administrative tasks or initiating critical and/or long running processes. Access to the serial console for many Sun servers is the only way to perform administrative tasks given these servers do not come with a frame buffer (i.e. video card). "

Linux Network Administrators Guide - Accessing Serial Devices:

"Like all devices in a Unix system, serial ports are accessed through device special files, located in the /dev directory. There are two varieties of device files related to serial drivers, and there is one device file of each type for each port. The device will behave slightly differently, depending on which of its device files we open. We'll cover the differences because it will help you understand some of the configurations and advice that you might see relating to serial devices, but in practice you need to use only one of these. At some point in the future, one of them may even disappear completely."

ACCES I/O - Linux Serial Configuration:

"In order to configure serial ports for Linux, you will need to make use of the setserial command.

Firstly, you will need to know the card's base address and and which IRQ it is using. "

Text-Terminal-HOWTO: Terminal Special Files such as /dev/tty:

""tty" is an abbreviation for "Teletype". The first terminals were Teletypes (like remotely controlled typewriters). See subsection Teletypes. A list of Linux devices (the stuff in the /dev directory) may be found in "Linux Allocated Devices" which should be included with kernel sources. It "describes" what each device used for in only a word or two but doesn't tell you how to use them."

Serial HOWTO: Multiport Serial Boards/Cards/Adapters:

"Multiport serial cards install in slots in a PC on the ISA or PCI bus. They are also called "... adapters" or "... boards". Each such card provides you with many serial ports. Today they are commonly used for the control of external devices (including automation for 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."

Text-Terminal-HOWTO: Terminal Special Files such as /dev/tty:

""tty" is an abbreviation for "Teletype". The first terminals were Teletypes (like remotely controlled typewriters). See subsection Teletypes. A list of Linux devices (the stuff in the /dev directory) may be found in "Linux Allocated Devices" which should be included with kernel sources. It "describes" what each device used for in only a word or two but doesn't tell you how to use them. "

Linux Serial How-To - 6.5 Making Legacy Multiport Devices in the /dev Directory:

"An installation script may do this for you. But if not, here's some examples of how to create a device name in the /dev directory. If you use udev, MAKEDEV will not create devices in the device directory since this directory is only in memory and will be lost when you turn off the computer. Instead it will create the device in dev/.static/dev directory."

Online - Serial HOWTO: Multiport Serial Boards/Cards/Adapters:

"An installation script may do this for you. But if not, here's some examples of how to create a device name in the /dev directory. If you use udev, MAKEDEV will not create devices in the device directory since this directory is only in memory and will be lost when you turn off the computer. Instead it will create the device indev/.static/dev directory."

Linux Online - Serial HOWTO: Configuring Overview:

"In most cases configuring is automatically taken care of and you have nothing to do. Linux should detect your serial ports, and load driver modules if needed. Then the driver should insure that IRQ and address space resources have been allocated. Finally, the application program which uses the serial port should set the port speed, etc."

Serial HOWTO: Serial Port Basics

"The serial port (not the USB) is usually a RS-232-C, EIA-232-D, or EIA-232-E. These three are almost the same thing. The original RS (Recommended Standard) prefix officially became EIA (Electronics 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 Other Serial Devices (not async RS-232)"

Serial HOWTO: Serial Port Devices /dev/tts/2 = /dev/ttyS2, etc.:

"Once upon a time the names of the serial ports were simple. Except for some multiport serial cards they were named /dev/ttyS0, /dev/ttyS1, etc. Then around the year 2000 came the USB bus with names like /dev/ttyUSB0 and /dev/ttyACM1 (for the ACM modem on the USB bus)."

Linux Online - Serial HOWTO: Serial Tips And Miscellany:

"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. "

Serial HOWTO:

"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. "

Linux I/O port programming mini-HOWTO: Some useful ports:

"Here is some programming information for common ports that can be directly used for general-purpose TTL (or CMOS) logic I/O."

Linux Online - Serial HOWTO: Serial Port Devices /dev/tts/2 = /dev/ttyS2, etc.:

"Once upon a time the names of the serial ports were simple. Except for some multiport serial cards they were named /dev/ttyS0, /dev/ttyS1, etc. Then around the year 2000 came the USB bus with names like /dev/ttyUSB0 and /dev/ttyACM1 (for the ACM modem on the USB bus)."

The Serial Driver Layer | Linux Journal:

" Greg explains the interface to the new serial driver layer and how to register a serival driver and an individual serial port.
In the last two installments of Driving Me Nuts [LJ August 2002 and October 2002], we covered the tty layer, explaining how to create a minimal tty driver. We also explained some of the various ioctls and how to interpret the termios structure. Those articles are a great start if you have to implement a new tty-type device for your embedded system, such as a serial port. For every new system that is designed, the hardware engineers always like to place the serial port at a different address, or use a different UART, or sometimes just forget the serial port and use a USB port. So most developers want to create a whole new tty driver for their new devices in order for the hardware to work properly on Linux. Fortunately, there are some layers above the tty layer that help buffer its complexities and provide the developer with a lot of common functions that are needed for a serial driver and that fit the UART or USB model better. These layers are the serial and USB to serial driver layers. We cover the serial driver layer in this article and will cover the USB to serial layer in a future article. "

Serial Drivers:

"This article is meant to show the internal structure of device drivers for serial ports, and how they can be perform a variety of services including ppp and slip. The discussion is based on 2.4 source code, but most of the material applies equally well to 2.2 and 2.0. "

A Linux serial port test program:

"Below is a Linux serial test program which requires the command parameters to be entered on the command line when the program is started. This program will send output typed on the computer keyboard after the program is started, through the serial port specified. This program can be downloaded using this link: com.c. I recommend that you right click on the link to download it rather than viewing it in your browser and saving it so you do not get carriage returns and line feeds in the text which may cause the compilation to fail. "

Linux Serial Console HOWTO:

"Have you ever needed to connect a dumb terminal (like a Wyse 50) to a Linux host? Do you need to login to a Linux server from a laptop to perform administrative functions, because there is no monitor or keyboard attached to the server? If you are accustomed to administering routers, switches, or firewalls in this manner, then you may be interested in doing the same with some of your GNU/Linux hosts. This HOWTO will explain, step-by-step, how to setup a serial console for Red Hat 9, although most of it should apply to other distributions as well.
Why did I write this document? Although there are lots of documents available on the Internet dealing with Linux serial ports, most of them seemed to be either out of date, or focused on modem dial-in/dial-out. I wanted consise documentation on how to setup simple terminal access via RS-232-C serial ports for Red Hat 9."

Linux I/O port programming mini-HOWTO:

"This HOWTO document describes programming hardware I/O ports and waiting for small periods of time in user-mode Linux programs running on the Intel x86 architecture."

Linux Online - Serial HOWTO: Multiport Serial Boards/Cards/Adapters:

"Multiport serial cards install in slots in a PC on the ISA or PCI bus. They are also called "... adapters" or "... boards". Each such card provides you with many serial ports. Today they are commonly used for the control of external devices (including automation for 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 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."

Serial Programming HOWTO:

"This document describes how to program communications with devices over a serial port on a Linux box. "

Linux Serial Console

"To use a serial port as console you need to compile the support into your
kernel - by default it is not compiled in. For PC style serial ports
it's the config option next to "Standard/generic (dumb) serial support".
You must compile serial support into the kernel and not as a module."

Accessing Serial Devices:

"Like all devices in a Unix system, serial ports are accessed through device special files, located in the /dev directory. There are two varieties of device files related to serial drivers, and there is one device file of each type for each port. The device will behave slightly differently, depending on which of its device files we open. We'll cover the differences because it will help you understand some of the configurations and advice that you might see relating to serial devices, but in practice you need to use only one of these. At some point in the future, one of them may even disappear completely."

Linux Console Redirect

Test with:

echo "hello" > /dev/ttyS0

Append the following in /boot/grub/grub.conf after "hiddenmenu" option

serial --unit=1 --speed=19200
terminal --timeout=8 console serial

Comment out splash in /boot/grub/grub.conf:

#splashimage=...

Append to kernel line in /boot/grub/grub.conf:

kernel ... console=tty0 console=ttyS0,19200n8
# or
kernel ... console=tty0 console=ttyS0,9600n8

Append to /etc/inittab:

1:23:respawn:/sbin/agetty -h -L ttyS0 19200 vt100
S0:23:respawn:/sbin/agetty -h -L ttyS0 19200 vt100

This is a handy way to kernel panic: [5] [6]

echo c >/proc/sysrq-trigger
# dd if=/dev/random of=/dev/port
# cat /dev/port
# cat /dev/zero > /dev/mem  # causes a reboot

References:

keywords

serial port minicom /dev/ttyS0