All Topics  
Universal asynchronous receiver/transmitter

 

   Email Print
   Bookmark   Link






 

Universal asynchronous receiver/transmitter



 
 
A universal asynchronous receiver/transmitter (usually abbreviated UART and ) is a type of "asynchronous receiver/transmitter", a piece of computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
 hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 that translates data between parallel and serial forms. UARTs are commonly used in conjunction with other communication standards such as EIA
Electronic Industries Alliance

The Electronic Industries Alliance is a trade organization composed as an alliance of trade associations for electronics manufacturers in the United States....
 RS-232
RS-232

In telecommunications, RS-232 is a standard for serial communications binary data signals connecting between a DTE and a DCE . It is commonly used in computer serial ports....
.

A UART is usually an individual (or part of an) integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
 used for serial communications
Serial communications

In telecommunication and computer science, serial communication is the process of sending data one bit at one time, sequentially, over a communication channel or computer bus....
 over a computer or peripheral device serial port
Serial port

In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time ....
.






Discussion
Ask a question about 'Universal asynchronous receiver/transmitter'
Start a new discussion about 'Universal asynchronous receiver/transmitter'
Answer questions from other users
Full Discussion Forum



Encyclopedia


A universal asynchronous receiver/transmitter (usually abbreviated UART and ) is a type of "asynchronous receiver/transmitter", a piece of computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
 hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 that translates data between parallel and serial forms. UARTs are commonly used in conjunction with other communication standards such as EIA
Electronic Industries Alliance

The Electronic Industries Alliance is a trade organization composed as an alliance of trade associations for electronics manufacturers in the United States....
 RS-232
RS-232

In telecommunications, RS-232 is a standard for serial communications binary data signals connecting between a DTE and a DCE . It is commonly used in computer serial ports....
.

A UART is usually an individual (or part of an) integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
 used for serial communications
Serial communications

In telecommunication and computer science, serial communication is the process of sending data one bit at one time, sequentially, over a communication channel or computer bus....
 over a computer or peripheral device serial port
Serial port

In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time ....
. UARTs are now commonly included in microcontrollers. A dual UART or DUART combines two UARTs into a single chip. Many modern ICs now come with a UART that can also communicate synchronously; these devices are called USARTs.

Definition


Transmitting and receiving serial data

Serial transmission of digital information (bits) through a single wire or other medium is much more cost effective than parallel transmission through multiple wires. A UART is used to convert the transmitted information between its sequential and parallel form at each end of the link. Each UART contains a shift register
Shift register

In digital circuits, a shift register is a group of flip-flop s set up in a linear fashion which have their inputs and outputs connected together in such a way that the data is shifted down the line when the circuit is activated....
 which is the fundamental method of conversion between serial and parallel forms.

The UART usually does not directly generate or receive the external signals used between different items of equipment. Typically, separate interface devices are used to convert the logic level signals of the UART to and from the external signaling levels.

External signals may be of many different forms. Examples of standards for voltage signaling are RS-232
RS-232

In telecommunications, RS-232 is a standard for serial communications binary data signals connecting between a DTE and a DCE . It is commonly used in computer serial ports....
, RS-422 and RS-485 from the EIA
Electronic Industries Alliance

The Electronic Industries Alliance is a trade organization composed as an alliance of trade associations for electronics manufacturers in the United States....
. Historically, the presence or absence of current (in current loop
Current loop

A current loop describes two different electrical signalling schemes....
s) was used in telegraph circuits. Some signaling schemes do not use electrical wires. Examples of such are optical fiber, IrDA (infrared
Infrared

Infrared radiation is electromagnetic radiation whose wavelength is longer than that of visible light , but shorter than that of terahertz radiation and microwaves ....
), and (wireless) Bluetooth
Bluetooth

Bluetooth is a wireless protocol for exchanging data over short distances from fixed and mobile devices, creating personal area networks . It was originally conceived as a wireless alternative to RS232 data cables....
 in its Serial Port Profile (SPP). Some signaling schemes use modulation of a carrier signal (with or without wires). Examples are modulation of audio signals with phone line modem
Modem

Modem is a peripheral device that modulation an analog carrier wave Signal to encode digital information, and also demodulation such a carrier signal to decode the transmitted information....
s, RF modulation with data radios, and the for power line communication
Power line communication

Power line communication or power line carrier , also known as Power line Digital Subscriber Line , mains communication, power line telecom , or power line networking , is a system for carrying data on a conductor also used for electric power transmission....
.

Communication may be "full duplex" (both send and receive at the same time) or "half duplex" (devices take turns transmitting and receiving).

As of 2008, UARTs are commonly used with RS-232
RS-232

In telecommunications, RS-232 is a standard for serial communications binary data signals connecting between a DTE and a DCE . It is commonly used in computer serial ports....
 for embedded systems communications. It is useful to communicate between microcontrollers and also with PCs. Many chips provide UART functionality in silicon, and low-cost chips exist to convert logic level signals (such as TTL
Transistor-transistor logic

File:68k ttl.jpgTransistor?transistor logic is a class of digital circuits built from bipolar junction transistors and resistors. It is called transistor?transistor logic because both the logic gating function and the amplifying function are performed by transistors ....
 voltages) to RS-232 level signals (for example, Maxim's
Maxim Integrated Products

Maxim Integrated Products is a publicly traded company that designs, manufactures, and sells high-performance semiconductor products. The company?s stated mission is to deliver innovative analog and mixed-signal engineering solutions that add value to its customers? products....
 MAX232
MAX232

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in Transistor-transistor logic compatible digital logic circuits....
).

Asynchronous receive and transmit


In asynchronous transmitting, teletype-style UARTs send a "start" bit, five to eight data bits, least-significant-bit first, an optional "parity" bit, and then one, one and a half, or two "stop" bits. The start bit is the opposite polarity of the data-line's idle state. The stop bit is the data-line's idle state, and provides a delay before the next character can start. (This is called asynchronous start-stop
Asynchronous start-stop

Asynchronous serial communication describes an asynchronous communication, Serial communication in which a start signal is sent prior to each byte, character or code word and a stop signal is sent after each code word....
 transmission). In mechanical teletypes, the "stop" bit was often stretched to two bit times to give the mechanism more time to finish printing a character. A stretched "stop" bit also helps resynchronization.

The parity bit can either make the number of "one" bits between any start/stop pair odd, or even, or it can be omitted. Odd parity is more reliable because it assures that there will always be at least one data transition, and this permits many UARTs to resynchronize.

In synchronous transmission, the clock data is recovered separately from the data stream and no start/stop bits are used. This improves the efficiency of transmission on suitable channels since more of the bits sent are usable data and not character framing. An asynchronous transmission sends no characters over the interconnection when the transmitting device has nothing to send -- only idle stop bits; but a synchronous interface must send "pad" characters to maintain synchronism between the receiver and transmitter. The usual filler is the ASCII
ASCII

American Standard Code for Information Interchange , is a coding standard that can be used for interchanging information, if the information is expressed mainly by the written form of English words....
 "SYN" character. This may be done automatically by the transmitting device.

USART chips have both synchronous and asynchronous modes.

Serial to Parallel Algorithm


A data communication pulse
Pulse (signal processing)

In signal processing, the term pulse has the following meanings:#A rapid, transient change in the amplitude of a Signalling from a baseline value to a higher or lower value, followed by a rapid return to the baseline value....
 can only be in one of two states but there are many names for the two states. When on, circuit closed, low voltage, current flowing, or a logical zero, the pulse is said to be in the "space" condition. When off, circuit open, high voltage, current stopped, or a logical one, the pulse is said to be in the "mark" condition. A character code begins with the data communication circuit in the space condition. If the mark condition appears, a logical one is recorded otherwise a logical zero.

Figure 1 shows this format.

The start bit is always a 0 (logic low), which is also called a space. The start bit signals the receiving DTE
Data terminal equipment

Data terminal equipment is an end instrument that converts user information into signals or reconverts received signals. A DTE device communicates with the data circuit-terminating equipment ....
 that a character code is coming. The next five to eight bits, depending on the code set employed, represent the character. In the ASCII code set the eighth data bit may be a parity bit. The next one or two bits are always in the mark (logic high, i.e., '1') condition and called the stop bit(s). They provide a "rest" interval for the receiving DTE
Data terminal equipment

Data terminal equipment is an end instrument that converts user information into signals or reconverts received signals. A DTE device communicates with the data circuit-terminating equipment ....
 so that it may prepare for the next character which may be after the stop bit(s). The rest interval was required by mechanical Teletypes which used a motor driven camshaft to decode each character. At the end of each character the motor needed time to strike the character bail (print the character) and reset the camshaft.

All operations of the UART hardware are controlled by a clock signal which runs at a multiple (say, 16) of the data rate - each data bit is as long as 16 clock pulses. The receiver tests the state of the incoming signal on each clock pulse, looking for the beginning of the start bit. If the apparent start bit lasts at least one-half of the bit time, it is valid and signals the start of a new character. If not, the spurious pulse is ignored. After waiting a further bit time, the state of the line is again sampled and the resulting level clocked into a shift register. After the required number of bit periods for the character length (5 to 8 bits, typically) have elapsed, the contents of the shift register is made available (in parallel fashion) to the receiving system. The UART will set a flag indicating new data is available, and may also generate a processor interrupt
Interrupt

In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
 to request that the host processor transfers the received data. In some common types of UART, a small first-in, first-out (FIFO) buffer memory is inserted between the receiver shift register and the host system interface. This allows the host processor more time to handle an interrupt from the UART and prevents loss of received data at high rates.

Transmission operation is simpler since it is under the control of the transmitting system. As soon as data is deposited in the shift register, the UART hardware generates a start bit, shifts the required number of data bits out to the line,generates and appends the parity bit (if used), and appends the stop bits. Since transmission of a single character may take a long time relative to CPU speeds, the UART will maintain a flag showing busy status so that the host system does not deposit a new character for transmission until the previous one has been completed; this may also be done with an interrupt. Since full-duplex operation requires characters to be sent and received at the same time, practical UARTs use two different shift registers for transmitted characters and received characters.

Transmitting and receiving UARTs must be set for the same bit speed, character length, parity, and stop bits for proper operation. The receiving UART may detect some mismatched settings and set a "framing error" flag bit for the host system; in exceptional cases the receiving UART will produce an erratic stream of mutilated characters and transfer them to the host system.

Typical serial ports used with personal computers connected to modems use eight data bits, no parity, and one stop bit; for this configuration the number of ASCII character per seconds equals the bit rate divided by 10.

History


Some early telegraph schemes used variable-length pulses (as in Morse code
Morse code

Morse code is a type of character encoding that transmits telegraphic information using rhythm. Morse code uses a standardized sequence of short and long elements to represent the alphanumeric, punctuation and special characters of a given message....
) and to transmit alphabetic characters. The first UART-like devices (with fixed-length pulses) were rotating mechanical switches (commutators). These sent 5-bit Baudot code
Baudot code

The Baudot code, invented by ?mile Baudot, is a character encoding predating EBCDIC and ASCII, and the root predecessor to International Telegraph Alphabet No 2 , the teleprinter code in use until the advent of ASCII....
s for mechanical teletypewriters, and replaced morse code
Morse code

Morse code is a type of character encoding that transmits telegraphic information using rhythm. Morse code uses a standardized sequence of short and long elements to represent the alphanumeric, punctuation and special characters of a given message....
. Later, ASCII
ASCII

American Standard Code for Information Interchange , is a coding standard that can be used for interchanging information, if the information is expressed mainly by the written form of English words....
 required a seven bit code. When IBM built computers in the early 1960s with 8-bit characters, it became customary to store the ASCII code in 8 bits.

Gordon Bell
Gordon Bell

C. Gordon Bell is a computer engineer and manager. An early employee of Digital Equipment Corporation , Bell designed several of their Programmed Data Processor machines and later became Vice President of Engineering, overseeing the development of the VAX....
 designed the UART for the PDP
Programmed Data Processor

Programmed Data Processor was the name of a series of minicomputers made by Digital Equipment Corporation. The name 'PDP' intentionally avoided the use of the term 'computer' because at the time of the first PDPs, computers had a reputation of being large, complicated, and expensive machines, and the venture capitalists behind Digital would...
 series of computers. Western Digital
Western Digital

Western Digital Corporation is a manufacturer of computer hard disk drives, and has a long history in the electronics industry as an integrated circuit maker and a storage products company....
 made the first single-chip UART WD1402A around 1971; this was an early example of a medium scale integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
.

An example of an early 1980s UART was the National Semiconductor
National Semiconductor

National Semiconductor is a semiconductor manufacturer, specializing in analog devices and subsystems,headquartered in Santa Clara, California, California, United States....
 8250. In the 1990s, newer UARTs were developed with on-chip buffers. This allowed higher transmission speed without data loss and without requiring such frequent attention from the computer. For example, the popular National Semiconductor 16550
16550 UART

The 16550 UART is an integrated circuit designed for implementing the interface for serial communications. It is frequently used to implement the serial port for IBM PC compatible personal computers, where it is often connected to an RS-232 interface for modems, serial Computer mouse, printers, and similar peripherals....
 has a 16 byte FIFO
FIFO

FIFO is an acronym for First In, First Out, an abstraction in ways of organizing and manipulation of data relative to time and prioritization....
, and spawned many variants, including the 16C550, 16C650, 16C750, and 16C850.

Depending on the manufacturer, different terms are used to identify devices that perform the UART functions. Intel called their 8251 device a "Programmable Communication Interface". MOS Technology
MOS Technology

MOS Technology, Inc., also known as CSG , was a integrated circuit design and Semiconductor device fabrication company based in Norristown, Pennsylvania, in the United States....
 6551
MOS Technology 6551

The 6551 Asynchronous Communications Interface Adapter was an integrated circuit made by MOS Technology. It served as a companion UART chip for the widely popular MOS Technology 6502 microprocessor....
 was known under the name "Asynchronous Communications Interface Adapter" (ACIA). The term "Serial Communications Interface" (SCI) was first used at Motorola
Motorola

Motorola, Inc. is an United States, multinational, Fortune 100, telecommunications company based in Schaumburg, Illinois. It is a manufacturer of wireless telephone handsets, also designing and selling wireless network infrastructure equipment such as cellular transmission base stations and signal amplifiers....
 around 1975 to refer to their start-stop asynchronous serial interface device, which others were calling a UART.

Some very low-cost home computers or embedded systems dispensed with a UART and used the CPU
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
 to sample the state of an input port or directly manipulate an output port for data transmission. While very CPU-intensive, since the CPU timing was critical, these schemes avoided the purchase of a costly UART chip. The technique was known as a bit-banging
Bit-banging

Bit-banging is a technique for serial communications to use software instead of dedicated hardware such as a UART or shift register. A software routine handles the UART transmit function by alternating a pin on the microcontroller by given time intervals....
 serial port.

Structure

A UART usually contains the following components:
  • a clock generator, usually a multiple of the bit rate to allow sampling in the middle of a bit period.
  • input and output shift registers
  • transmit/receive control
  • read/write control logic
  • transmit/receive buffers (optional)
  • parallel data bus buffer (optional)
  • First-in, first-out (FIFO
    FIFO

    FIFO is an acronym for First In, First Out, an abstraction in ways of organizing and manipulation of data relative to time and prioritization....
    ) buffer memory (optional)


Special Receiver Conditions


Overrun Error

An "overrun error" occurs when the UART receiver cannot process the character that just came in before the next one arrives. Various UART devices have differing amounts of buffer space to hold received characters. The CPU must service the UART in order to remove characters from the input buffer. If the CPU does not service the UART quickly enough and the buffer becomes full, an Overrun Error will occur.

Underrun Error

An "underrun error" occurs when the UART transmitter has completed sending a character and the transmit buffer is empty. In asynchronous modes this is treated as an indication that no data remains to be transmitted, rather than an error, since additional stop bits can be appended. This error indication is commonly found in USARTs, since an underrun is more serious in synchronous systems.

Framing Error

A "framing error" occurs when the designated "start" and "stop" bits are not valid. As the "start" bit is used to identify the beginning of an incoming character, it acts as a reference for the remaining bits. If the data line is not in the expected idle state when the "stop" bit is expected, a Framing Error will occur.

Parity Error

A "parity error" occurs when the number of "active" bits does not agree with the specified parity configuration of the UART, producing a Parity
Parity

Parity is a concept of equality of status or functional equivalence. It has several different specific definitions.* Parity , the name of the symmetry of interactions under spatial inversion...
 Error
. Because the "parity" bit is optional, this error will not occur if parity has been disabled. Parity error is set when the parity of an incoming data character does not match the expected value.

Break Condition

A "break condition" occurs when the receiver input is at the "space" level for longer than some duration of time, typically, for more than a character time. This is not necessarily an error, but appears to the receiver as a character of all zero bits with a framing error.

Some equipment will deliberately transmit the "break" level for longer than a character as an out-of-band signal. When signaling rates are mismatched, no meaningful characters can be sent, but a long "break" signal can be a useful way to get the attention of a mismatched receiver to do something (such as resetting itself). UNIX
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 systems and UNIX-like systems such as Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
 can use the long "break" level as a request to change the signaling rate.

Baudrate


In embedded designs, it is necessary to choose proper oscillator to get correct baud rate with small or no error. Some examples of common crystal frequencies and baud rates with no error:

  • 18.432 MHz: 18,432,000 = 300, 600, 1200, 2400, 4800, 9600, 19200
  • 22.118400 MHz: 22,118,400 = 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 38400, 57600, 115200
  • 16 MHz: 16,000,000 = 125000, 500000


See also

  • Asynchronous serial communication
  • Baud
    Baud

    In telecommunications and electronics, baud is synonymous to symbols/s or pulses/s. It is the unit of symbol rate, also known as baud rate or modulation rate; the number of distinct symbol changes made to the transmission medium per second in a digitally modulation signal or a line code....
  • bit rate
  • Modem
    Modem

    Modem is a peripheral device that modulation an analog carrier wave Signal to encode digital information, and also demodulation such a carrier signal to decode the transmitted information....
  • Morse code
    Morse code

    Morse code is a type of character encoding that transmits telegraphic information using rhythm. Morse code uses a standardized sequence of short and long elements to represent the alphanumeric, punctuation and special characters of a given message....
  • Serial communication
  • Serial port
    Serial port

    In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time ....
  • USB


External links

  • (includes standard signal definitions, history of UART ICs, and pinout for commonly used DB25 connector)
  • (contains many practical examples)