UART Embedded systems, microcontrollers, and computers mostly use UART as a form of device-to-device hardware communication protocol. Among the available communication protocols, UART uses only two wires for its transmitting and receiving ends. UART, or universal asynchronous receiver-transmitter, is one of the most used device-to-device communication protocols. UART is a hardware communication protocol that uses asynchronous serial communication with configurable speed. Asynchronous means there is no clock signal to synchronize the output bits from the transmitting device going to the receiving end.
|Speed||9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1000000, 1500000|
|Methods of Transmission||Asynchronous|
|Maximum Number of Masters||1|
|Maximum Number of Slaves||1|
The UART interface does not use a clock signal to synchronize the transmitter and receiver devices because it transmits data asynchronously. Instead of a clock signal basically transmitter generates a bitstream based on its clock signal while the receiver is using its internal clock signal to sample the incoming data. The point of synchronization is managed by having the same baud rate on both devices. Failure to do so may affect the timing of sending and receiving data that can cause discrepancies during data handling.
You can use UART for many applications, such as:
- Debugging: Early detection of system bugs is important during development thus adding UART can help in this scenario by capturing messages from the system.
- Manufacturing function-level tracing: Logs are very important in manufacturing. They determine functionalities by alerting operators to what is happening on the manufacturing line.
- Customer or client updates: Software updates are highly important. Having complete, dynamic hardware with update-capable software is important to having a complete system.
- Testing/verification: Verifying products before they leave the manufacturing process helps deliver the best quality products possible to customers.
The UART data transmission line is normally held at a high voltage level when it’s not transmitting data in order to start the transfer of data, the transmitting UART pulls the transmission line from high to low for one clock cycle. When the receiving UART detects the high to low voltage transition, it begins reading the bits in the data frame at the frequency of the baud rate.
The data frame contains the actual data being transferred which can be 5 bits up to 8 bits long if a parity bit is used. If no parity bit is used, the data frame can be 9 bits long. In most cases, the data is sent with the least significant bit first.
Parity describes the evenness or oddness of a number. The parity bit is a way for the receiving UART to tell if any data has changed during transmission. Bits can be changed by electromagnetic radiation, mismatched baud rates, or long distance data transfers. After the receiving UART reads the data frame, it counts the number of bits with a value of 1 and checks if the total is an even or odd number.
If the parity bit is a 0 (even parity), the 1 bits in the data frame should total to an even number. If the parity bit is a 1 (odd parity), the 1 bits in the data frame should total to an odd number. When the parity bit matches the data, the UART knows that the transmission was free of errors. But if the parity bit is a 0, and the total is odd; or the parity bit is a 1, and the total is even, the UART knows that bits in the data frame have changed.
To signal the end of the data packet, the sending UART drives the data transmission line from a low voltage to a high voltage for at least two bit durations.
- Only uses two wires like I2C
- No clock signal is necessary
- Has a parity bit to allow for error checking
- The structure of the data packet can be changed as long as both sides are set up for it.
- Well documented and widely used method.
- The size of the data frame is limited to a maximum of 9 bits.
- Doesn’t support multiple slave or multiple master systems.
- The baud rates of each UART must be within 10% of each other.
For using UART protocol there are converter in market for USB to TTL(https://robu.in/product/usb-serial-adapter-module-usb-ttl-rs232-arduino-cable), Serial to TTL(https://www.amazon.in/Robodo-Electronics-TTLTO232-Converter-Connector/dp/B07B9454YZ/ref=asc_df_B07B9454YZ) for taking UART data on PC.