Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views11 pages

Uart

Uploaded by

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

Uart

Uploaded by

VIVEKKUMAR118
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

UART

Universal Asynchronous Receiver / Transmitter


UART
(Universal Asynchronous Receiver / Transmitter)
"Universal" means the protocol can be applied to
any compatible transmitter and receiver.
"Asynchronous" indicates that it does not use a
clock signal for data communication.

UART is a commonly used hardware communication


protocol that enables serial data exchange between
devices using just two wires, one for transmitting and
one for receiving. It’s called "Universal" because it can
work with various devices, and "Asynchronous"
because it doesn’t need a shared clock signal for
synchronization. UART is ideal for point-to-point
communication, such as between microcontrollers
and peripherals, and it can operate in half-duplex or
full-duplex modes for one-way or two-way data
transmission.

2
Kaviselvan
UART Connection

TX TX

RX RX

GND GND

DEVICE A DEVICE B

Here, DEVICE A has a Transmitter (TX) pin and a


Receiver (RX) pin, and DEVICE B also has a Receiver (RX)
and Transmitter (TX) pin. The TX of DEVICE A should be
connected to the RX of DEVICE B, and the TX of DEVICE
B should be connected to the RX of DEVICE A. Only two
wires are needed to establish this communication..

If DEVICE A wants to send data, it transmits through its


TX pin, which is received by the RX pin of DEVICE B.
Similarly, if DEVICE A wants to receive data, it does so
through its RX pin, which gets the data sent from the TX
pin of DEVICE B.

A common ground is essential


in UART communication to define
high and low signals; without it,
devices may misinterpret the
transmitted data.
3
Kaviselvan
Parallel Communication

Transmitter Receiver

Compared to parallel communication, UART serial


communication requires only two lines, making it less
complex and more efficient in terms of wiring. In
contrast, parallel communication needs multiple data
lines (buses), which increases complexity but offers
higher data transfer speeds.

Therefore, when high-speed data transfer is required,


parallel communication is preferred due to its faster
performance. However, for low-speed applications
where simplicity and minimal wiring are important,
UART serial communication is a better choice as it
reduces bus complexity.

4
Kaviselvan
How UART Works
UART operates by transmitting data one bit at a time in
a specific sequence, starting with a start bit, followed
by data bits, an optional parity bit, and one or more stop
bits. Unlike parallel communication, where multiple bits
are sent simultaneously, UART sends bits serially. As
the name suggests, it is asynchronous, meaning it
doesn’t use a shared clock signal; instead, it relies on
predefined baud rates to synchronize the timing of data
transmission.

Serial Communication
parity idle
TX RX
1 0 1 1 0 0 1
start stop

Parallel Communication

1
0
1
1
TX RX
0
0
1
0

In parallel communication, an 8-bit message requires


eight separate data lines...
Serial communication simplifies this by using just one
wire for sending and one for receiving.
5
Kaviselvan
Baud Rate
Baud Rate is a key parameter in UART communication,
defining the number of bits transmitted per second
(bps). Both transmitting and receiving devices must use
the same baud rate to communicate correctly. A higher
baud rate enables faster data transfer but requires
precise timing, while a lower baud rate offers more
tolerance in timing but slower communication.

eg: In Arduino example,

Serial.begin(9600);

The baud rate is simply the number of symbol


changes (bits) per second.

Bit time (𝑇bit )

1 1
baud rate = __ ⟹ 𝑇bit = _________
𝑇bit baud rate

For 9600 bps:

1
𝑇bit = __________ ≈ 0.00010417 s = 104.17 μs
9600 bits/s

6
Kaviselvan
Frame duration
Each UART frame typically consists of:
1 start bit
5–8 data bits (commonly 8)
0 or 1 parity bit
1 or 2 stop bits

If you use 8 data bits, no parity, 1 stop bit, then a


frame is 10 bits long. The time to send one frame is:

T frame
​ = ( start + data + parity + stop ) × T bit
​ = 10 × 104.17 μs ≈ 1.0417 ms

Implications
Higher baud → smaller T​bit → faster data but tighter
timing tolerances.
Lower baud → larger T​bit → slower data but more
forgiving timing.

By calling Serial.begin(9600);, you ensure both Arduino


TX and RX agree on T =104.17 μs. bit so bits are sampled at
the correct instants.

7
Kaviselvan
UART Frame Format
Start and stop bits mark the beginning and end of each
data frame, helping the sender and receiver stay
synchronized.

UART Frame Format


idle parity idle
TX RX
1 0 1 1 0 0 1
start stop

Start Bit

In UART communication, each data frame starts with a


single start bit. The start bit is always logic low (0),
indicating the beginning of data transmission. This low
signal alerts the receiver to prepare for incoming data.
Once the receiver detects the start bit, it begins timing
the reception of the following bits in the frame.

idle parity idle


TX RX
1 0 1 1 0 0 1
start stop

Start Bit

8
Kaviselvan
Data Bit

Data bits carry the actual information being


transmitted. While the most common configuration is 8
data bits, UART also supports other sizes like 7 or 6 bits,
depending on the application’s needs.

idle parity idle


TX RX
1 0 1 1 0 0 1
start stop

Data Bit

Parity Bit

It’s an error-checking feature added to the data frame.


It helps detect transmission errors by ensuring the total
number of bits set to logic "1" is either even or odd,
based on the selected parity type. If the received data
doesn’t match the expected parity, the receiver flags it
as an error, indicating possible data corruption.

idle parity idle


TX RX
1 0 1 1 0 0 1
start stop

Parity Bit

9
Kaviselvan
If even parity is used, the total number of 1s in the data
(including the parity bit) must be even. If odd parity is
used, the total must be odd.

Stop Bit

Stop bit(s) are sent after the data bits to indicate the
end of a data frame. The most common setup uses one
stop bit, but two stop bits can be used for added
reliability. Stop bits are usually at logic high (1), though
their polarity may vary depending on the system’s
configuration.

idle parity idle


TX RX
1 0 1 1 0 0 1
start stop

Stop Bit

10
Kaviselvan
USART
Universal Synchronous/Asynchronous Receiver/Transmitter

UART supports only asynchronous communication (no clock line).

USART supports both:


Asynchronous mode (like UART).
Synchronous mode, where a clock signal is used along with
data for faster and more reliable communication.

USART = UART + Synchronous mode

CLK CLK

TX TX

RX RX

GND GND

DEVICE A DEVICE B

Synchronous mode

CLOCK

DATA
1 1 0 1 1 0 0 1

11
Kaviselvan

You might also like