Serial communication allows a series of bytes (or ASCII characters) to be sent along a cable. The bytes of data are sent as a series of successive "baud"s. Each baud is a signalling bit one the cable. (not all bauds carry data, some are sued for overhead).
At the sender, a shift register (in either hardware or software) is used to serialise each information byte into the sequence of bits that are then sent using an I/O port and a bus driver to connect to the cable.
At the receiver, the remote system reassembles the sequence of bits to form a byte. This is then forwarded for processing by the link layer, where successive bytes form a frame that may be interpreted.
A clock (timing signal) is also needed at the receiver to clock data into the receive shift register. This must identify the timing of each bit (in practice it is preferable to identify the centre of the bit - since this usually indicates the point of maximum signal power). There are two basic ways that timing may be provided on a communications link:
Non-return to zero (NRZ) encoding is commonly used in slow speed communications interfaces for both synchronous and asynchronous transmission. Using NRZ, a logic 1 bit is sent as a high value and a logic 0 bit is sent as a low value (the line driver chip used to connect the cable may subsequently invert these signals). This works fine for asynchronous communications (where the clock resynchronises every byte), but requires additional methods when used with synchronous signals.
At the sender a clock is used to drive the shift register, clocking out each bit to the physical layer interface. A clock (timing signal) is also needed at the receiver to clock data into the receive shift register. This must identify the timing of each bit (in practice it is preferable to identify the centre of the bit - since this usually indicates the point of maximum signal power).
There are two modes of transmission: synchronous and asynchronous:
This leads to two systems for timing:
The asynchronous communication is a transmission technique that is widely used to provide connectivity to printers, scientific and industrial equipment, networking devices, etc.
Serial communication may be supported using a Universal Asynchronous Receiver/Transmitter (available as a separate Integrated Circuit, IC), but many microntrollers integrate a UART in their design to directly support asynchronous communication. If no UART is available, lower rate serial transmission can be easily performed using software only via a standard I/O pin.
The most significant aspect of asynchronous communications is that the transmitter and receiver clock are independent and are not synchronised. In fact, there need be no timing relationship between successive characters (or bytes of data). Individual characters may be separated by any arbitrary idle period.
An asynchronous link communicates data as a series of bytes with a fixed size and format.
There is an arbitrary idle gap between slots, identified by a Mark level (high). In most asynchronous link designs, the bits in a byte are sent Least Significant Bit (LSB) first, using a shift register. Each byte is preceded by a start baud and followed by either 1 or 2 stop bauds. The asynchronous transmitter delimits each character (byte) by a start sequence and a stop sequence. The start bit (0), data (usually 8 bits possibly with one parity bit) and 1 or 2 stop bauds(s).
The bauds are transmitted using a shift register clocked at the nominal baud rate.
A parity check bit is sometimes added before the stop bit to provide some limited protection against errors occurring on the link. The use of independent transmit and receive clocks constrains transmission to relatively short characters (<8 bits) and moderate data rates (< 64 kbps, but typically lower).
The additional bauds used for overhead rather than data reduce the number of bits available for useful transmission, and increase the duration of time required to send a byte of data. If an asynchronous transmission baud rate is 9600 bps, the minimum duration required to send a byte is:
8 bits /slot - 3 overhead bauds (start and 2 stop bauds) - total = 11 bauds (assuming minimum idle).
11/9600 = 1.2 mS
The start of each slot is therefore identified by the receiver by a downwards (space) transition in the received line voltage. This triggers reception of the 11-bit slot using a shift register. There is no direct synchronisation between sender and receiver (e.g. DPLL or clock signal). Instead, each independently uses a locally generated copy of the clock set to the nominal baud rate. If the last two (stop) bits are not both set to one, then the slot is discarded.
Packet data frames
Asynchronous serial links are often used to support packet data links (e.g. NMEA GPS, DMX, RDM), where bytes are grouped together. Special sequences are used ("framing") to indicate the start and end of each frame transmitted. The set of rules governing what sequence of bytes are sent is known as a protocol.
The principle difference between the synchronous and asynchronous modes of transmission is that in the synchronous case, the receiver uses a clock which is synchronised to the transmitter clock. The clock may be transferred by:
Synchronous transmission has the advantage that the timing information is accurately aligned to the received data, allowing operation at much higher data rates. It also has the advantage that the receiver tracks any clock drift which may arise (for instance due to temperature variation). The penalty is however a more complex interface design.
A problem arises when using NRZ to encode a synchronous link which may have long runs of consecutive bits with the same value. The figure below illustrates the problem that would arise if NRZ encoding were used with a DPLL recovered clock signal, as in synchronous CAN bus. If the encoded data contains long 'runs' of logic 1's or 0's, this does not result in any bit transitions. The lack of transitions prevents the receiver DPLL from reliably regenerating the clock making it impossible to detect the boundaries of the received bits at the receiver, thus in CAN bus a bit-stuffing method is used to eliminate consecutive runs' of logic 1's or 0's.
A long run of bits with the same value results in no transitions on the cable when NRZ encoding is used
If you ever have connected a computer terminal to a storage oscilloscope to look at the waveform you may have been rather puzzled at the result! Click HERE to find out why.
Prof. Gorry Fairhurst, School of Engineering, University of Aberdeen, Scotland. (2014)