0% found this document useful (0 votes)
38 views17 pages

Basics of UART Communication

UART (Universal Asynchronous Receiver/Transmitter) is a circuit that allows microcontrollers and other devices to communicate by transmitting serial data using only two wires. UARTs convert parallel data to serial data for transmission and then convert it back to parallel data for receipt. Data is transmitted asynchronously without a clock signal by adding start and stop bits around the data. Both the transmitting and receiving UART must be configured with the same baud rate and data packet structure.

Uploaded by

tuan.ebook3
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)
38 views17 pages

Basics of UART Communication

UART (Universal Asynchronous Receiver/Transmitter) is a circuit that allows microcontrollers and other devices to communicate by transmitting serial data using only two wires. UARTs convert parallel data to serial data for transmission and then convert it back to parallel data for receipt. Data is transmitted asynchronously without a clock signal by adding start and stop bits around the data. Both the transmitting and receiving UART must be configured with the same baud rate and data packet structure.

Uploaded by

tuan.ebook3
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/ 17

10/9/23, 12:46 PM Basics of UART Communication

   

Raspberry Pi Arduino DIY Electronics Programming Videos Resources

SEARCH …

BASICS OF UART COMMUNICATION SUBSCRIBE

Posted by Scott Campbell | DIY Electronics | 79 


Get new tutorials sent
to your inbox!

EMAIL ADDRESS

SUBSCRIBE

Remember when printers, mice, and modems had thick cables with those
huge clunky connectors? The ones that literally had to be screwed into
your computer? Those devices were probably using UARTs to communicate
with your computer. While USB has almost completely replaced those old
cables and connectors, UARTs are definitely not a thing of the past. You’ll find
UARTs being used in many DIY electronics projects to connect GPS modules,
Bluetooth modules, and RFID card reader modules to your Raspberry Pi,
Arduino, or other microcontrollers.

UART stands for Universal Asynchronous Receiver/Transmitter. It’s not a


communication protocol like SPI and I2C, but a physical circuit in a
microcontroller, or a stand-alone IC. A UART’s main purpose is to transmit and
receive serial data.

One of the best things about UART is that it only uses two wires to transmit
data between devices. The principles behind UART are easy to understand, but
if you haven’t read part one of this series, Basics of the SPI Communication
Protocol, that might be a good place to start.
s-IEC 61850-104 Gateway - Substation
ol Converter
INTRODUCTION TO UART COMMUNICATION OPEN

ened with IAM / Certificate Management and 2 Factor Authentication kalkitech.com

https://www.circuitbasics.com/basics-uart-communication/ 1/17
10/9/23, 12:46 PM Basics of UART Communication

In UART communication, two UARTs communicate directly with each other.


The transmitting UART converts parallel data from a controlling device like a
CPU into serial form, transmits it in serial to the receiving UART, which then
converts the serial data back into parallel data for the receiving device. Only
two wires are needed to transmit data between two UARTs. Data flows
from the Tx pin of the transmitting UART to the Rx pin of the receiving UART:

UARTs transmit data asynchronously, which means there is no clock signal to


synchronize the output of bits from the transmitting UART to the sampling of
bits by the receiving UART. 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. The baud rate between the
transmitting and receiving UARTs can only differ by about 10% before the
timing of bits gets too far off.

Both UARTs must also must be configured to transmit and receive the same
data packet structure.

HOW UART WORKS


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 another device like a CPU,
memory, or 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. Next, 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. Finally, the receiving UART
transfers the data packet in parallel to the data bus on the receiving end:

https://www.circuitbasics.com/basics-uart-communication/ 2/17
10/9/23, 12:46 PM Basics of UART Communication

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:

START BIT
The UART data transmission line is normally held at a high voltage level when
it’s not transmitting data. 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.

DATA FRAME
The data frame contains the actual data being transferred. It 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
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.

STOP BITS
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.

STEPS OF UART TRANSMISSION


1. The transmitting UART receives data in parallel from the data bus:

https://www.circuitbasics.com/basics-uart-communication/ 3/17
10/9/23, 12:46 PM Basics of UART Communication

2. The transmitting UART adds the start bit, parity bit, and the stop bit(s) to the
data frame:

3. The entire packet is sent serially from the transmitting UART to the receiving
UART. The receiving UART samples the data line at the pre-configured baud
rate:

4. The receiving UART discards the start bit, parity bit, and stop bit from the
data frame:

5. The receiving UART converts the serial data back into parallel and transfers it
to the data bus on the receiving end:

ADVANTAGES AND DISADVANTAGES OF UARTS

https://www.circuitbasics.com/basics-uart-communication/ 4/17
10/9/23, 12:46 PM Basics of UART Communication

No communication protocol is perfect, but UARTs are pretty good at what they
do. Here are some pros and cons to help you decide whether or not they fit the
needs of your project:

ADVANTAGES

Only uses two wires

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

DISADVANTAGES

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

Continue on to part three of this series, Basics of the I2C Communication


Protocol to learn about another way electronic devices communicate. Or if you
haven’t already, check out part one, Basics of the SPI Communication Protocol.

And as always, let us know in the comments if you have questions or anything
else to add! If you liked this article and want to see more like it, be sure to
subscribe- we send out an email when ever we publish new posts.

SHARE:     

RELATED POSTS

How to Use Servos Introduction to Complete Guide to Essential Tools and


in Your Electronics Capacitance Electronic Equipment for the
Projects Protection Circuits DIY Electronics
Hobbyist

79 COMMENTS

vivek on June 2, 2016 at 4:43 am

https://www.circuitbasics.com/basics-uart-communication/ 5/17
10/9/23, 12:46 PM Basics of UART Communication

Nice one. But there is a scope of introducing RS232 concept here

REPLY

Taskeen on September 10, 2017 at 1:54 pm


Thank you for this beautiful explanation.. Great

REPLY

Graham Lambert on April 21, 2020 at 2:35 pm


You say in 2 places it only uses 2 wires. If you want tx
and rx you need a ground wire as well. ie It must use
3 wires not 2

REPLY

dhruv busa on October 18, 2022 at 1:23 pm


right you need a ground wire

REPLY

Anuj on March 22, 2019 at 4:37 am


As follow up articles yes to both- RS232 &RS485.
But so often than not we consider UART to be a protocol.
And consider RS232 and UART as the same thing.
In that aspect, not mentioning the protocols here is good
decision.

REPLY

Dinesh Yadav on September 26, 2016 at 7:09 am


Its Beautifully Explained. Frankly Speaking, After a hell lot of search
over Internet and books, THis is the only Place where I literally
Understood what Exactly UART is and its working.
Thanks a Lot guys.

A request: can you write another article to Explain How Exactly an


IC (made of transistors) Adds these bits (Start,parity,stop) and
Removes them. I mean how exactly they do this intelligent stuff at
Electronics level ? Please explain its Circuit basics. :)

REPLY

VIKAS S DEV on September 26, 2016 at 7:21 am


Well Explained and Nice Article.Thank You :)

REPLY

rekula raviteja on October 4, 2016 at 12:36 pm


It’s a good explanation.

REPLY

Ramesh Mote on October 8, 2016 at 8:00 pm


its very good explanation. thnks a lot.

REPLY

daya on April 23, 2018 at 11:31 am


https://www.circuitbasics.com/basics-uart-communication/ 6/17
10/9/23, 12:46 PM Basics of UART Communication

You are welcome Mote Saand

REPLY

Volthaus Electronics Laboratory on October 11, 2016 at 3:50 am


Excellent.

REPLY

Randall on October 24, 2016 at 4:34 pm


This was helpful but I’m unsure about one thing. If two bits gets
flipped in error, wouldn’t the total still match with the parity bit? Or
more generally, if an even number of bits get flipped in error, the
error won’t be detected. Is that right?

REPLY

Ricky on October 27, 2016 at 6:32 pm


Correct, the receiver will not notice the error, but, pending
good design of the hardware, this is going to be a rare case.

REPLY

ArchonOSX on December 18, 2016 at 2:17 pm


Your analysis is correct. That is why parity checking is
rudimentary and may not prevent all errors. But the odds of
two bits being changed is much higher than just one so this
method works in most cases of low level hardware
communication.

REPLY

Olivia Christy on November 4, 2016 at 7:01 am


Nice work. As a begginer this helps me a lot .can you do this for
uart with interrupts also

REPLY

rajkumar on November 30, 2016 at 9:58 am


Well explanation

REPLY

hardik tank on December 3, 2016 at 6:10 am


well explanation,and its easy to understand
friendly explanation ,,nice
thanx

REPLY

saks on December 7, 2016 at 4:44 am


really easy of understanding and way of explanation is good

REPLY

haleem on December 11, 2016 at 3:38 pm


Nice one!

REPLY

https://www.circuitbasics.com/basics-uart-communication/ 7/17
10/9/23, 12:46 PM Basics of UART Communication

vj on December 16, 2016 at 1:05 pm


very good expaination. I have one question that we also use Usb
micro port for connectiing uart hardware and the other USB port
type A to our laptop. How does it work? does uart support USB
ports also?

REPLY

Harshal on January 4, 2017 at 10:40 am


no uart does not support the usb ports

REPLY

OF on December 20, 2016 at 11:07 pm


“It’s not a communication protocol like SPI and I2C, but a physical
circuit in a microcontroller, or as a separate IC”.

This part confuses me. I understand that UART is a physical


hardware IC, but it must also be a protocol because how else
would there be communication? The bits can’t just be sent
randomly. Data is sent through packets just like you described in a
timely matter and specific order. Isn’t that in essence a protocol?
Thanks.

REPLY

Tom S on December 20, 2017 at 7:27 am


It is a very confusing statement, because I2C and SPI
perform a similar low level task – transmitting and receiving
bytes between devices.

A UART doesnt have to be a physical IC, and it doesnt even


need to be circuitry inside a microcontroller – just like I2C
and SPI it can be implemented entirely in software by “bit
banging” general purpose I/O pins.

REPLY

rk yadav on December 22, 2016 at 5:40 am


good explanation to thanks

REPLY

karthik on January 2, 2017 at 11:02 am


thanks for the good information. simple and best.

REPLY

nagul sharief on January 19, 2017 at 10:05 am


i’m not understanding of parity bit

REPLY

Harshal on February 2, 2017 at 4:47 am


Parity bit is that it show that how many bit are there and if
there are even number is there then it will pass bit 1 or bit 0

REPLY

https://www.circuitbasics.com/basics-uart-communication/ 8/17
10/9/23, 12:46 PM Basics of UART Communication

Syed Ibrahim on March 8, 2017 at 4:19 am


Good post. Its in a language everyone can understand. But i also
want to know how communication (data transfer) between data
bus and UART occurs.

REPLY

ankur singh on March 21, 2017 at 10:12 am


It is really a very good explanation as i m not from electrical
background.

REPLY

Chandru on March 23, 2017 at 8:33 am


Can anyone say how can I transmit 1000 bytes of data through uart
protocol

REPLY

k t r on April 4, 2017 at 12:26 pm


Awsome explenation really

REPLY

Hemavathi on May 15, 2017 at 8:25 am


Really good explaination. Now i understood very clearly what
exactly The UART performs internally

REPLY

thoshif khan on July 12, 2017 at 6:30 am


i am working on UART so any body can send VHDL CODE to my
mail [email protected]

REPLY

k.sudheer kumar on July 13, 2017 at 5:11 am


It is an nice explanation .Thank you

REPLY

Flash9325 on September 26, 2017 at 11:21 pm


1) The two UARTs communicating having the same baud rate, does
that mean the clocks of both the UARTs are synchronized ( i.e clock
cycle starts and stops at the same time) ?

I didnt get from where that allowed difference of 10% came from.
Can you please explain!!!

REPLY

dinesh aitha on October 30, 2017 at 3:17 pm


10% come fromm start and stop bits and parity too

REPLY

RK on November 27, 2017 at 9:50 am


https://www.circuitbasics.com/basics-uart-communication/ 9/17
10/9/23, 12:46 PM Basics of UART Communication

Thank you soo much.. Thanks a ton. Really U ppl had done a
great job. Now seriously I understood the working principle,
data transmission of bits and everything without any doubt.
Thanks again and again. Hope you upload more and more
sessions and concepts like this.

REPLY

Tom Storey on December 20, 2017 at 8:14 am


The clocks of the two systems do not need to be
synchronised in any way, and they can run at entirely
different speeds.

UART is self-timed – each individual bit occupies a specific


amount of time based on the configured baud rate, e.g.
~104uS at 9600 baud (1 / 9600). So the key to making this
work, using 9600 baud as an example, is that the
transmitter needs to alternate the TX pin at 104uS intervals,
and the receiver needs to sample its RX pin at 104uS
intervals to reconstruct what has been sent. The receiver
starts this process once it sees the start bit.

If the transmitter or receiver differ significantly enough in


this measurement because they have such different baud
rates configured, then the rate at which the transmitter
alternates its TX pin and the rate that the receiver samples
its RX pin means you either miss entire bits, or read the
same bit more than once.

10% of error is way too much and is a bad suggestion. See:


https://www.allaboutcircuits.com/technical-articles/the-uart-
baud-rate-clock-how-accurate-does-it-need-to-be/

REPLY

thomas on June 18, 2019 at 12:31 pm


So its not possible to communicate between two
mcu’s with different clock speeds?

REPLY

Hari on October 30, 2017 at 6:55 am


Why we using 9bits institute data transmission

REPLY

Karthik gv on December 20, 2017 at 7:23 am


After a long days after completing engineering understood the
concept of UART
Thanks for sharing.

REPLY

OGBONNA VITALIS on February 26, 2018 at 11:45 pm


Nice one…where can/is this UART protocol applied. Which module
uses this protocol

REPLY

vineeshvs on May 28, 2018 at 6:00 am


Good one.

https://www.circuitbasics.com/basics-uart-communication/ 10/17
10/9/23, 12:46 PM Basics of UART Communication

REPLY

navaneeth on May 28, 2018 at 9:29 am


why we use ground in the uart communication as a common
terminal to both transmitter and receiver.

REPLY

lcabs on June 30, 2018 at 6:31 am


You need that third wire (GND) for electrical purposes. Both
devices have to agree on a voltage reference. Otherwise, the
meaning of 1s and 0s would be lost.

REPLY

Madhu s g on October 5, 2018 at 4:47 pm


A fantastic explanation ever about UART!

REPLY

MauriciO on October 25, 2018 at 7:05 am


Nice explanation! Suggestion to add: if two bits change during the
transmission of the datapacket then the Parity bit error check
doesn’t work. So it’s a rather weak form of error checking.

REPLY

erika on January 30, 2019 at 6:17 am


Thanks for the feedback, I am going to improve the UART
technology pretty soon, stay tuned for updates!

REPLY

jawad haidar on January 9, 2019 at 3:44 pm


Great explanation. if the baud rate is 9600 bits per second, this
means that every 1/9600 second am sending a bit, this raises the
following question, the time between sending two consecutive
bits, what’s happening in this time? the serial line getting back to
zero, right?

REPLY

chalith lakshan on February 5, 2019 at 2:23 am


Wow its a great article. Can u guyz just upload the ‘C codes’
happening inside the transmission and receiving.
That will be great!!!

REPLY

MaaNDA on February 8, 2019 at 5:14 am


I love it

REPLY

kishore on February 20, 2019 at 9:57 am


Really very good explanation, pls keep going posting on updates

REPLY

https://www.circuitbasics.com/basics-uart-communication/ 11/17
10/9/23, 12:46 PM Basics of UART Communication

PrASHANT on April 2, 2019 at 5:20 am


That was just awesome.I was totally new to the world of electronics
and I don’t even know what the UART is?Now I got to know in just
a single reference of yours that what a UART is and how it
works.This helped me a lot in my final project…MY BIG BIG Thanks
to you.

REPLY

Sravya on April 10, 2019 at 9:39 am


Yeah! Really nice explanation in an easy manner

REPLY

Muthukumar on April 16, 2019 at 5:47 am


Good Explanation…

REPLY

Raghu on April 17, 2019 at 12:25 pm


Great explanation with simple words. Anyone even without a prior
knowledge of communication protocols can learn the concept
perfectly with the help of this article. Thank you!

REPLY

VIJAY on May 4, 2019 at 11:45 am


Why we are connecting common ground in UART..
Please cover this point also..

REPLY

Sino-Instrument on May 24, 2019 at 5:16 am


Good Explanation

https://www.drurylandetheatre.com/

REPLY

ELANGOVAN KUMAR on May 30, 2019 at 2:35 pm


what will happen if RX uart is in off state and TX uart is started
transmission(both are physically connected).
how TXuart will come to know whether RX uart received or not.

REPLY

KrUpa on June 8, 2019 at 9:40 am


‘If the parity bit is a 1 (odd parity), the 1 bits in the data frame should
total to an odd number.”
This line is under the parity paragraph.
I think the 1 bits in the data frame should total to an even number
because data frame includes data of size 5-8(data frame) where
the next bit is a parity. For odd parity(parity bit as 1) the sum of 1
bits has to be even in the data frame.

REPLY

https://www.circuitbasics.com/basics-uart-communication/ 12/17
10/9/23, 12:46 PM Basics of UART Communication

Satish Chappidi on July 2, 2019 at 6:41 am


NICE EXPLANATION BRIEFLY ………
GIVE SUGGESTIONS GET ORIGINAL DATA SHEET OF UART ……

REPLY

50BAR lpg cylinder on July 13, 2019 at 7:56 am


ld include mainly propane mixtures, most commonly propane and
butane mixtures. Mixtures contain more propane in winter in the
northern hemisphere and more butane in summer.

In the United States,cooking gas cylinder two grades of liquefied


petroleum gas are mainly sold: commercial propane and HD-5.
Propane/butane mixtures are also listed in these specifications.
Propylene, butene and various other hydrocarbons are also
commonly present in small concentrations. HD-5 will limit the
propylene content that can be placed in LPG to 5% and be used as
an automatic gas specification.

Strong odorant ethanethiol, easy to detect


A powerful odorant, ethanethiol, was added to make leaks easy to
detect. The internationally recognized European standard is EN
589. In the United States, Tetrahydrothiophene (thiophene) or amyl
mercaptan are also approved, although they are not currently
used.
LPG is prepared by refining oil or “wet” natural gas, almost entirely
from fossil fuel sources, and is manufac

REPLY

Srahas on July 30, 2019 at 8:17 am


As you explained above
In parity check when ever the UART Rx will get to know that the
data frame had changed, will it send a request for original data
frame or what it is going to do after knowing the data frame had
changed ??

REPLY

Jt on September 14, 2019 at 5:00 pm


Best damn explanation yet!

REPLY

Ramesh on September 20, 2019 at 1:12 pm


UART is full duplex or half duplex

REPLY

Daniel Selvan D on September 17, 2021 at 4:51 am


The UART component can be configured for Full Duplex,
Half Duplex, RX only or TX only versions. All versions provide
the same basic functionality differing only in the amount of
resources utilized

Ref: https://www.cypress.com/file/132486

REPLY

https://www.circuitbasics.com/basics-uart-communication/ 13/17
10/9/23, 12:46 PM Basics of UART Communication

Moulika on September 30, 2019 at 7:02 am


Can I know why it’s not called a communication protocol still two
UART’s have to communicate with Tx and Rx signals as in SPI :
MOSI, MISO?

REPLY

Nayana on October 12, 2019 at 8:57 am


Thank you very much. It is explained very well for beginners.

REPLY

Mallika on November 12, 2019 at 11:35 am


Very good material. Please upload CAN protocol also.
Thank U

REPLY

Gowtham R on December 12, 2019 at 4:56 am


Hello Sir,

As you said due to Electromagnetic Radiation Data bits can


change..! and Error can be detected by the Receiver
What if Data bits doesn’t change and the parity bit got change due
to radiation..??

REPLY

avi on January 4, 2020 at 5:02 pm


how does the receiver distinguish between a data bit and stop bit.
In ‘Steps of UART transmission’ step #3, diagram shows that the
last bit transmitted is 1 – how can receiver distinguish between this
and any other data bit.

REPLY

Naveen kumar on January 8, 2020 at 8:45 am


Hi,
May I know the Use of Rx Pin of UART Transmitter and Tx Pin of
UART Receiver while the Data Transmission is happening from Tx
Pin of UART Transmitter to Rx Pin of UART Receiver

REPLY

Curie Gupta on April 18, 2020 at 7:30 am


Thank you for the clear explanation.
Looking forward to more such articles.

REPLY

Cassim peer on August 7, 2020 at 1:24 am


I have a Project with 5 LX-16A Bus Servos.
I have LewanSoul Bus Servo Controller
I need to setup a Coordinated Action
I need to set the servo motors to swing 180 degrees
ID 1 will start and return to 0 degrees.
ID 2 will start 5 to 10 seconds after ID 1
ID 3 will start 5 to 10 seconds after ID 2

https://www.circuitbasics.com/basics-uart-communication/ 14/17
10/9/23, 12:46 PM Basics of UART Communication

ID 4 will start 5 to 10 seconds after ID 3


ID 5 will start 5 to 10 seconds after ID 4.

I have No knowledge of electronic communication.


Your UART explanation has opened a new window.
Can you help setting these Data Packets for the Coordinated
Action.
Alternatively direct me to someone that can help me with this
project.
Thank you
Cassim
E:[email protected]

REPLY

Graham Lambert on August 7, 2020 at 6:37 am


Hi Cassim This was not my article?
I see it did not say who wrote it?
Ill try find out

REPLY

logari84 on October 9, 2020 at 12:08 pm


“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.”

This is a little bit misleading and poorly written. Parity bit is not 0
on even parity and 1 in odd parity. Parity bit can be 1 or 0
depending on the situation. In case of even parity, the total
number of ‘1’ bits, including the parity bit, should be even. In
contrast, in odd parity, the total number of ‘1’ bits, including parity
bit, should be odd. So parity bit is either ‘1’ or ‘0’ to satisfy the
requirement I described before. An example always makes things
more clear.

Consider transmission of byte ‘10100010’. The number of ‘1’ bits is 3


(odd).
– Even parity: to make the number of ‘1’ bits even we need one
more (3+1 = 4 which is even). Consequently the parity bit should be
‘1’, resulting in transmission of ‘101000101’
– Odd parity: the number of ‘1’ bits is already odd so we don’t need
to add something. Consequently the parity bit should be ‘0’,
resulting in transmission of ‘101000100’

Hope that makes it more clear.

REPLY

Eric on August 28, 2021 at 12:20 am


Uart, no longer just an acronym. From what I gathered from this
awesome write up and using memory of other articles. My thought
is the uart, is a shift register with rx\tx on one side and bus inputs
filled by mcu, cpu, whatever.laptop uart Tx h, Rx h, chilling. Bus
filled (tx L for 1 baud) = start. 5-9 high or lows (1=5v 1baud) (0=0v
1baud} (5-8 if use parity) parity bit (count 1s in 5-8 bits compair to
me the parity bit which is not added due to the fact I’m set by the
mcu, cpu, or whatever.) Once all my bits are in and the stop bit
brings my rx high for 2 or more baud all bits transfer to bus
instantly on there own pin, wire whatever, and bam ready for
another start bit. Only about 9588 baud left in this second so
whatever

https://www.circuitbasics.com/basics-uart-communication/ 15/17
10/9/23, 12:46 PM Basics of UART Communication

REPLY

Caio on October 16, 2021 at 3:26 pm


Hi, i’ve much enjoyed these basic concepts from the series. Thanks
a lot! Can you tell me names of nice books on the subjects (SPI, I²C
and UART) ?

REPLY

praveen on May 4, 2023 at 10:10 am


need explanation on Ethernet communication

REPLY

LEAVE A REPLY
Your email address will not be published. Required fields are marked *

COMMENT

NAME * EMAIL * WEBSITE

Save my name, email, and website in this browser for the next time I comment.

Notify me of follow-up comments by email.

Notify me of new posts by email.

For security, use of Google's reCAPTCHA service is required which is subject to the Google
Privacy Policy and Terms of Use.

I agree to these terms.

POST COMMENT

https://www.circuitbasics.com/basics-uart-communication/ 16/17
10/9/23, 12:46 PM Basics of UART Communication

Copyright Circuit Basics


Raspberry Pi Arduino DIY Electronics Programming Videos Resources About Contact Us Privacy Policy    

https://www.circuitbasics.com/basics-uart-communication/ 17/17

You might also like