Serial Port Configuration

If you are running a Linux server you almost certainly want to use it for dial-up networking. However there are a couple of things you need to be wary of with serial ports.

Internal modems - interrupt conflicts

If your computer already has a COM1 and COM2 serial port, then you will need to install your internal modem as COM3 or COM4. Unfortunately, the way the PC was originally designed, the choice of Interrupt Request (IRQ) lines leads to a conflict, and won't work under Linux:
Port   Linux device  Base I/O Addr   IRQ
COM1      ttyS0           3F8         4
COM2      ttyS1           2F8         3
COM3      ttyS2           3E8         4 [*]  clashes with COM1
COM4      ttyS3           2E8         3 [*]  clashes with COM2
The solution is to set your modem to a different interrupt; good choices are COM3-IRQ5 (unless you have a sound card, which is often already using IRQ5) and COM4-IRQ2. (IRQ2 is the same as IRQ9 on a PC, so if your modem has a link for IRQ9, that's fine too). Don't use IRQ7 - this is used by the printer port.

Once you have set up your modem, using on-board jumpers or DIP switches, you need to tell Linux when it boots to use a different IRQ. Add a line or lines like this to /etc/rc.d/rc.local

    setserial -v /dev/ttyS2 irq 5
    setserial -v /dev/ttyS3 irq 2
If you need to install an internal modem as COM1 or COM2, and your PC already has a COM1 or COM2, then you must disable the existing COM port. This might be a jumper on your I/O card, or for motherboards with on-board I/O, a BIOS setup setting.

External modems - old UARTs

The chip in your PC which converts parallel information into a serial data stream to your modem, and back again, is called a UART (Universal Asynchronous Receiver Transmitter). The original UART (part number 8250 or 16450) could only hold one character at a time, which meant that if the processor didn't fetch characters from it quickly enough, they could be lost. The new UART is called a 16550A, and can buffer up to 16 characters, making data loss much less likely and reducing the workload on the processor too.

It's easy to check which you have - look at the kernel messages when the system boots up, which you can see afterwards using the following command:

    dmesg | less
If you have 8250 or 16450 UARTs, they are unlikely to work at above 9600 bits per second (and even at 9600 may loose characters occasionally). Upgrade your PC's I/O card to one which has 16550A UARTs; this shouldn't cost you more than around US$30.

Most internal modems have 16550A UARTs on board - so this problem doesn't arise for them. Most modern motherboards also have 16550A UARTs on-board.

Last updated 14 June 1998