Remember when printers, mice and modems had thick cables with these huge clumsy connectors? Those that literally had to screw into the computer? Few people know that these UART components were used to communicate with your computer. USB technology has almost completely replaced these old cables and connectors. The UART interfaces described in this article are not a thing of the past. They are used in many DIY electronics projects to connect GPS, Bluetooth, and RFID card readers to Pi, Arduino, or other microcontrollers.
UART Interface: Description
UART stands for Universal Asynchronous Receiver / Transmitter. This is not a communication protocol such as SPI and I2C, but a physical circuit in a microcontroller. The main goal is to transmit and receive information. One of the best technological advances is that it uses only two wires.
A UART interface is two devices that communicate with each other. The transmitting source converts the information from the control device, such as the central processor, into serial form, transmits it in sequential order to the receiving UART, which converts the values ββfor the receiving device. Only two wires are required to transfer information between two devices.
Introduction to UART Communication
The UART RS485 transmits data asynchronously, which means there is no signal to synchronize the output of bits from the transmitting device to the receiving device. Instead of a clock signal, the transmitting UART adds the start and end bits of the transmitted packet. These options determine the beginning and end of the document.
When the receiving UART detects a start bit, it begins to read the incoming bits at a specific frequency, known as the bit rate. Data transfer rate is a measure of the speed expressed in a unit of measure, - bit / s. Both devices should work at approximately the same baud rate. The transmission speed between transmitting and receiving devices may vary by 10%.
Both devices must also be configured to transmit and receive the same packet structure.
UART - what is it and how does it work?
A UART that is about to transmit information receives it from the data bus. It is used to send information to another device, such as a processor, memory, or microcontroller. After the transmitting UART receives parallel data from the data bus, it adds a start, parity, and stop bit, creating a data packet. Then the packet is displayed sequentially, in parts. The receiving UART reads a data bit to its output. The receiving UART converts the information back to parallel form, deletes the start and stop bits. Finally, the receiving UART transmits the data packet parallel to the data bus on the receiving side.
A transmission line is usually kept at a high voltage level when it does not transmit information. To start transmitting data, the transmitting UART pulls the transmission line from high to low in one clock cycle. When the receiving UART detects a transition from high to low voltage, it starts reading bits in a data frame with a baud rate.
Technical features
The basic UART system provides reliable, moderate speed, full duplex communication with three signals: Tx (transmitted serial data), Rx (received serial data) and ground. Unlike other protocols, such as SPI and I2C, no clock signal is required because the user provides the necessary time information to the UART hardware.
A typical data signal in the description of the UART interface is simply the voltage that goes between a logic low and a logic high value. The receiver can correctly convert these logical states into digital data only if it knows when to try the signal. This can be easily done using a separate clock. For example, the transmitter updates the data signal at each edge of the front, and then the receiver samples the data at each falling edge.
Key Terms
The start bit is the first bit of a single byte transfer. This indicates that the data line is inactive. The idle state usually has a logical height, so the start bit is logically low.
The start bit is the overhead bit. This means that it facilitates communication between the receiver and the transmitter, but does not transmit meaningful data.
Stop bit - the last bit of a single byte transmission. Its logical level is the same as the idle state of the signal, that is, the logical maximum.
Step by Step Procedure
To signal the completion of a data packet, the sending UART connects the data line from low voltage to high voltage for two bits of duration.
UART Interface Description:
The transmitting UART receives data in parallel from the data bus and adds the start bit, parity bit, and stop bit (s) to the data frame.
The entire packet is sent sequentially from the transmitting to the receiving UART, which selects a data line with a pre-configured data rate.
The receiving UART discards the start, parity, and stop bits from the data frame, converts the serial data back to parallel, and transfers them to the data bus on the receiving side.
Converts received bytes from a computer in parallel to a single serial bit stream for outgoing transmission.
With an incoming transfer, it converts a serial bit stream into bytes that the computer processes.
Adds a parity bit (if one was selected) of outgoing transmissions, checks the parity of incoming bytes (if selected), discards the parity bit.
Adds separators of the beginning and end of outgoing, removes them from incoming transfers.
Advantages and disadvantages
The communication protocol is not perfect, but the UARTs are pretty good at what they do. Here are some pros and cons to help you decide if they fit the needs of your project:
Benefits:
Only two wires are used.
No sync signal.
Has a parity bit for error checking.
The structure of a data packet can be changed if both sides are configured for it.
Well-documented and widely used method.
Disadvantages:
In addition, the data transfer rate of each Arduino UART interface must be within 10% of each other.