Hardware manual
RS-232 (EIA-232, etc.)
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)
4.2 IO Address & IRQ
Since the computer needs to communicate with each serial port, the operating system must know that each
serial port exists and where it is (its I/O address). It also needs to know which wire (IRQ number) the serial
port must use to request service from the computer's CPU. It requests service by sending an interrupt voltage
on this wire. Thus every serial port device must store in its non-volatile memory both its I/O address and its
Interrupt ReQuest number: IRQ. See Interrupts. The PCI bus has its own system of interrupts. But since the
PCI-aware BIOS sets up these PCI interrupts to map to IRQs, it seemingly behaves just as described above.
Except that sharing of PCI interrupts is allowed (2 or more devices may use the same IRQ number).
I/O addresses are not the same as memory addresses. When an I/O addresses is put onto the computer's
address bus, another wire is energized. This both tells main memory to ignore the address and tells all devices
which have I/O addresses (such as the serial port) to listen to the address sent on the bus to see if it matches
the device's. If the address matches, then the I/O device reads the data on the data bus.
The I/O address of a certain device (such as ttyS2) will actually be a range of addresses. The lower address in
this range is the base address. "address" usually means just the "base address".
4.3 Names: ttyS0, ttyS1, etc.
The serial ports are named ttyS0, ttyS1, etc. (and usually correspond respectively to COM1, COM2, etc. in
DOS/Windows). The /dev directory has a special file for each port. Type "ls /dev/ttyS*" to see them. Just
because there may be (for example) a ttyS3 file, doesn't necessarily mean that there exists a physical serial
port there.
Which one of these names (ttyS0, ttyS1, etc.) refers to which physical serial port is determined as follows. The
serial driver (software) maintains a table showing which I/O address corresponds to which ttyS. This mapping
of names (such as ttyS1) to I/O addresses (and IRQ's) may be both set and viewed by the "setserial"
command. See What is Setserial. This does not set the I/O address and IRQ in the hardware itself (which is
set by jumpers or by plug-and-play software). Thus which physical port corresponds to say ttyS1 depends
both on what the serial driver thinks (per setserial) and what is set in the hardware. If a mistake has been
made, the physical port may not correspond to any name (such as ttyS2) and thus it can't be used. See Serial
Port Devices /dev/ttyS2, etc. for more details.
4.4 Interrupts
When the serial port receives a number of bytes (may be set to 1, 4, 8, or 14) into its FIFO buffer, it signals
the CPU to fetch them by sending an electrical signal known as an interrupt on a certain wire normally used
Serial HOWTO
RS-232 (EIA-232, etc.) 12