[go: up one dir, main page]

0% found this document useful (0 votes)
100 views4 pages

Understanding UART Protocol Basics

UART (Universal Asynchronous Receiver Transmitter) is a protocol for serial communication using two wires for transmission and reception, with data organized into packets containing start bits, data bits, optional parity bits, and stop bits. The protocol operates asynchronously, relying on start and stop bits rather than a clock signal, and requires both transmitting and receiving UARTs to be configured to the same baud rate and data packet structure. In comparison, I2C was chosen over UART for a project involving the MPU6050 sensor due to its support for synchronization and clocking, which is crucial for real-time data processing.

Uploaded by

techsaraagal123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views4 pages

Understanding UART Protocol Basics

UART (Universal Asynchronous Receiver Transmitter) is a protocol for serial communication using two wires for transmission and reception, with data organized into packets containing start bits, data bits, optional parity bits, and stop bits. The protocol operates asynchronously, relying on start and stop bits rather than a clock signal, and requires both transmitting and receiving UARTs to be configured to the same baud rate and data packet structure. In comparison, I2C was chosen over UART for a project involving the MPU6050 sensor due to its support for synchronization and clocking, which is crucial for real-time data processing.

Uploaded by

techsaraagal123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

UART PROTOCOL-

UART means universal Asynchronous Receiver Transmitter


Protocol.
It is used for serial communication. Two wires are established
here in which only one wire is used for transmission whereas
the second wire is used for reception.
Data flows from the Tx pin of the transmitting UART to the Rx pin of the
receiving UART:

Data format and transmission speeds can be configured here


we do not have a clock over here that’s why it is referred to as
asynchronous communication with UART protocol.
Instead of a clock signal, the transmitting UART adds start and stop bits to the
data packet being transferred. These bits define the beginning and end of the
data packet so the receiving UART knows when to start reading the bits
When the receiving UART detects a start bit, it starts to read the incoming
bits at a specific frequency known as the baud rate. Baud rate is a measure of
the speed of data transfer, expressed in bits per second (bps). Both UARTs must
operate at about the same baud rate.
Both UARTs must also must be configured to transmit and receive the same
data packet structure.

Working-
The UART that is going to transmit data receives the data from a data bus. The
data bus is used to send data to the UART by microcontroller.
Data is transferred from the data bus to the transmitting UART in parallel form.
After the transmitting UART gets the parallel data from the data bus, it adds a
start bit, a parity bit, and a stop bit, creating the data packet.
The data packet is output serially, bit by bit at the Tx pin. The receiving UART
reads the data packet bit by bit at its Rx pin. The receiving UART then converts
the data back into parallel form and removes the start bit, parity bit, and stop
bits.
The receiving UART transfers the data packet in parallel to the data bus on
the receiving end

UART transmitted data is organized into packets. Each packet contains 1 start
bit, 5 to 9 data bits (depending on the UART), an optional parity bit, and 1 or 2
stop bits:

Data Frame Structure-


UART communication is based on transmitting data in frames, which consist of
several parts:
1. Start Bit:
o A single bit that signifies the beginning of a data frame. The line is
pulled low (logic 0) for the duration of the start bit.
2. Data Bits:
o The actual data being transmitted, typically between 5 to 9 bits
long. Most commonly, 8 data bits are used.
3. Parity Bit (Optional):
o An error-checking bit used to detect errors in the data frame. It
can be even, odd, or none.
 Even Parity: The parity bit is set to ensure an even number
of 1s in the data frame.
 Odd Parity: The parity bit is set to ensure an odd number of
1s in the data frame.
4. Stop Bit(s):
o Indicates the end of the data frame. The line is pulled high (logic 1)
for one or more bit durations.

why did we choose i2c over UART in our project?


I2C Support:
 MPU6050: The MPU6050 is designed to communicate via the I2C
[Link] does not have a UART interface. The I2C interface is well-
supported and optimized for this sensor.
 ESP32: The ESP32 has multiple I2C buses available, allowing for easy
connection to the MPU6050 without needing additional hardware or
complex configuration
Synchronization and Clocking:
 I2C: The I2C protocol's inherent clock line (SCL) ensures
that data between the ESP32 and MPU6050 is
synchronized. This is important for time-sensitive
applications like a self-balancing bot, where sensor data
needs to be processed in real-time.
 UART: Lacks a dedicated clock line, which can lead to
synchronization issues if the timing isn't perfectly matched
between devices, potentially causing delays or data
corruption.

You might also like