Serial Interfaces

Serial interfaces transmit bits one after the other on a single conductor. They have become quite important in data transmission, as in the SCSI (small computer serial interface), USB (universal serial bus), FireWire and other examples. There are two principal types, synchronous and the somewhat misnamed asynchronous links. In a synchronous link, timing information to separate the bits is transmitted either on a separate conductor, or in the data stream itself. The fast serial links are always synchronous. The idea of the asynchronous link goes back to Baudot’s printing telegraph, which evolved into the Teletype. In this kind of link, the data is sent in words or groups, perhaps corresponding to individual characters. The beginning of each group starts a timing device that is accurate enough to separate the individual bits. It would not be possible to stay synchronized for an arbitrarily long string of bits, but this is easy for a small number of bits. The transmitter and receiver must agree on the speed to be used, but timing information need not be sent with the data. This permitted communication over a single telegraph line. Baudot’s code had five bits, but normally eight data bits are now sent in each group, preceded by a start bit that triggers the receiver timing, an optional parity bit for error checking, and followed by a stop bit that allows time for the receiver to reset for the next group.

The parity bit checks for the incorrect reception of any one bit in the data plus parity string. If even parity is agreed, then if the data bits have an even number of 1 bits, the parity bit is 0. If there is an odd number of 1 data bits, then the parity bit is 1, so that the total number of 1 bits in data plus parity is even. Odd parity works the same way, but the total number of 1 bits is made odd instead of even. The receiver checks the parity of the received group, and if it is wrong raises a flag, the PE (parity error) bit. The parity will be wrong if a 1 bit is received as 0, or a 0 bit is received as 1, in data plus parity. Two errors, however, will not be detected by a parity check. This elementary check is not very useful for the usual low-speed serial link, because errors are very rare, and if there are errors, the link does not work at all. Faster serial links depend on elaborate checking and error correction mechanisms, causing retransmission of any doubtful data. These checks are complex and system-specific.

A framing error occurs when the stop bit is not found in the expected place, implying that reception began on a false start bit (spacing condition of the line, possibly caused by noise or interference), or that the transmitter is out of order. An overrun error happens when received data is overwritten by subsequent data before it is read or otherwise disposed of. Parity, framing and overrun errors are usually automatically reported by the receiver circuits.

The bit rate is the number of bits transmitted per second, and the reciprocal of this is the bit time, or the length of a single bit. Each group consists of a stop bit, a certain number of data bits (usually 5,7 or 8), a possible parity check bit, and 1, 1-1/2 or 2 stop bits. Therefore, groups can be from 7 to 12 bit times long. We will assume a format of one start bit, eight data bits, and one stop bit, 10 bits in all. At 1200 bits per second, then, it requires 8.333 ms to send a complete group, or 120 characters per second. Allowing five characters per word, this is 1440 words per minute. This assumes on-off control of the line. More complicated modulation systems can send much more rapidly, as is done with modern modems. 1200 bits per second is sometimes called 1200 baud, but the baud unit has a somewhat esoteric definition that can lead to confusion with other than on-off control.

American telegraph lines were normally closed-circuit, with current flowing continuously. The current attracted the armature (through a relay) of the Morse register to emboss a mark on the paper tape, so this state was called mark. When the current was interrupted, the armature was released, and a space appeared on the moving tape. This state was called space, not surprisingly. These words are still used today for the two states of the line. An extended space was called a break, and was used to signal another operator. If an operator was sending, he heard himself on his sounder. If there was a break, the sound stopped and he knew something was up. This term is also still used.

RS-232 Levels

It is possible to use the ordinary TTL levels for short-distance communication. In fact, the parallel port does just this, and is reliable up to about 20 feet or so. The TTL levels are a good ground for low, or 0, and a wire pulled up to above 2.4 V for high, or 1. Such a circuit is susceptible to noise, interference from electrical discharges, such as the opening of a circuit, and crosstalk (interference with neighboring circuits). For longer distances, other arrangements must be made. A very popular serial interface for computers is the EIA Standard RS-232C. This is an excellent interface for moderate distances and low signalling speeds. The circuits have a common ground, and a line for which the mark state is from -3 to -15 V, while the space state is +3 to +15 V. To remember which is which, think Mark is Minus. If mark is given a logic level of 1, and space 0, then the line voltages are inverted with respect to the logic voltages.

It is clear that we need a bipolar supply and special transmitter and receiver circuits for RS-232 lines. We’ll discuss later what the various lines are in a complete interface, and consider them generally. All are electrically the same. The classic interface chips are the 1488 transmitter, and the 1489 receiver. The first thing you should do is wire up a test circuit, as shown at the left, and measure the logic and line voltages at each end of the link. If you use ±12 V supplies, the line will be at about -10 V marking, and +10 V spacing. The 1488 will make these levels, and the 1489 will accept them. The 1488 has an output resistance of about 300Ω, and the 1489 an input resistance of 7kΩ, which is specified by the standard. Of course, RS-232 lines should not be connected to the inputs of TTL, because they will fry the chips. Be careful with the wiring, because it is easy to ruin a 1488 by mistaken connections. Note that three of the 1488’s buffers are NAND gates. The middle connections on the 1489’s buffers are for adjusting the transition level. They can be connected to +5 or -5 through a 11k resistor to move the level up or down, but generally they will be left not connected. The maximum input voltage for the 1489 is ±30 V, while the maximum supply voltages for the 1488 are ±15 V.

An alternative to the 1488 and 1489 is the Maxim MAX232 chip, which not only transmits on two lines and receives on two, but also makes its own ±V supplies. One MAX232 is enough for a basic RS-232 interface, saving a lot of bother. Its circuit is shown at the right. Wire it up and test the voltage levels. Its output is close to ±10 V as well. Take special care to get the polarities of the electrolytic capacitors correct. Use 25 V rating capacitors.