Whole document tree
    

Whole document tree

Select a serial speed and parameters

3.3. Select a serial speed and parameters

This HOWTO does not discuss the RS-232 standard, which is formally known as ANSI/TIA/EIA-232-F-1997 Interface Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Data Interchange. For an explanation of ‘bits per second’, ‘start bits’, ‘data bits’, ‘parity’ and ‘stop bits’ refer to the Serial-HOWTO and the Modem-HOWTO.

The Linux kernel uses the syntax in Figure 3-1 to describe the serial parameters. Many boot loaders use a variation of the syntax used by the Linux kernel.

Figure 3-1. Serial parameter syntax, in extended Backus-Naur form

<mode> ::= <speed><parity><data><stop>
<speed> ::=  <digits>
<parity> ::= n | e | o
<data> ::= 7 | 8
<stop> ::= 1 | 2
<digits> ::= <digit> | <digit><digits>
<digit> ::= 0 | 1 | … | 9

The variables and their values are:

<speed>

The speed of the serial link in bits per second.

The Linux kernel on a modern PC supports 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bits per second. Higher bit rates may be possible depending upon the model of the serial port's semiconductor.

Most boot loaders only support a subset of this range. LILO 21.7.5 supports 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 56000, 57600 and 115200 bits per second. SYSLINUX 1.67 supports 75 to 56000 bits per second. GRUB 0.90 supports 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bits per second.

You must chose the same speed for both the boot loader and for the Linux kernel. An operating system may use more than one boot loader. For example, Red Hat Linux uses SYSLINUX to install or upgrade the operating system; LILO as the boot loader for Red Hat Linux 7.1 and earlier; and GRUB as the boot loader for Red Hat Linux 7.2 and later.

If you are using a serial terminal or if you are using a dumb modem then the bit rate of the terminal or dumb modem must also match the bit rate selected in the boot loader and kernel.

If the serial console is connected to a Hayes-style modem slower than 9600bps then configure the serial console with the same speed as the modem. Modems faster than 9600bps will generally automatically synchronize to the speed of the serial port.

The selected bit rate must also be supported by the serial port's semiconductor. Early model UARTs such as the 8250 series and the 16450 could only reliably recieve at up to 14400bps. The 16550 series and later models will work at all bit rates.

Unless you have good reason, use the popular bit rate of 9600 bits per second. This is the default bit rate of a great many devices.

The speeds that are supported by the kernel, the three common boot loaders, and all IBM PCs capable of running Linux are: 2400, 4800, 9600 and 19200 bits per second. This is a depressingly small selection: not slow enough to support a call over an international phone circuit and not fast enough to upload large files. You may need to choose a speed that will result in a less robust software configuration.

<parity>

Number of parity bits and the interpretation of a parity bit if one is present.

Allowed values are n for no parity bit, e for one bit of even parity and o for one bit of odd parity.

Using no parity bit and eight data bits is recommended.

If parity is used then even parity is the common choice.

Parity is a simple form of error detection. Modern modems have much better error detection and correction. As a result the parity bit guards only the data on the cable between the modem and the serial port. If this cable has a low error rate, and it should, then the parity bit is not required.

<data>

The number of data bits per character.

Allowed values are 7 bits or 8 bits, as Linux uses the ASCII character set which requires at least seven bits.

Eight data bits are recommended. This allows the link to easily be used for file transfers and allows non-English text to be presented.

<stop>

The number of stop bit-times.[1]

Allowed values are 1 or 2.

One stop bit-time is recommended.

If the RS-232 cable is very long then two stop bit-times may be needed.

You may occassionally see 1.5 stop bit-times. The intent is to gain 4% more data throughput when a link is too long for one stop bit-time but is too short to require two stop bit-times. 1.5 stop bit-times is now rare enough to be a hazard to use.

Most boot loaders default to 9600n81. A common default found on older terminals is 9600e71.

Use 9600n81 if possible, as this is the default for most Linux software and modern devices.

This HOWTO always configures the serial speed and parameters, even where not strictly necessary. This is so that people configuring parameters other than the recommended and common default value 9600n81 will know what to alter.

Notes

[1]

A bit-time is the time taken to transmit one bit. The distinction between bit-times of signal and bits of data is apparent when you consider that 1.5 bit-times of signal is possible but that 1.5 bits of data is impossible.