# SOLVED - How many bits micro transfer on uart bus

#### Sparsh45

Joined Dec 6, 2021
143
When three bytes of data sequence [A,B, C] sent from 8 bit micro to PC via UART protocol.

PC & micro is configured for 8N1, 9600

How much data will be sent throughout the communication?

It seems to me that the micro transfer a total of 30 bits on the UART bus including start and stop bit.

Is a total of 30 bits sent on the UART bus?

Last edited:

#### MrChips

Joined Oct 2, 2009
29,217
When three bytes of data sequence [A,B, C] sent from 8 bit micro to PC via UART protocol.

PC & micro is configured for 8N1, 9600

How much data will be sent throughout the communication?

It seems to me that the micro transfer a total of 30 bits on the UART bus including start and stop bit.

Is a total of 30 bits sent on the UART bus?
30 is correct though we don’t usually consider start and stop as bits.
In particular, the stop bit is the space before the next start bit is sent.

In terms of data transmitted, three bytes of data constitute 24 bits transmitted.
Start and stop bits are not data.

#### Papabravo

Joined Feb 24, 2006
20,384
This computation is only correct if the bytes are sent at the synchronous limit. That is with no time between the 10 bits required for each character, consisting of 8 data bits and 2 framing bits. The time between characters can be anything, including fractions of a bit time up to arbitrarily large intervals. You can count or ignore those intervals at your discretion.

#### Sparsh45

Joined Dec 6, 2021
143
This computation is only correct if the bytes are sent at the synchronous limit.
I'm a little confused what do you mean by synchronous limit mean?

USART has two modes asynchronous and synchronous.

Isn't 10 bits frame sent on bus to send 1 byte data in asynchronous mode ?

#### MrChips

Joined Oct 2, 2009
29,217
I believe that you are over-thinking this issue.
The start bit is one bit wide. The stop bit is the space before the next start bit. This space can be anything but must be at least equal or longer than one bit duration. As Papa said, these are just framing bits. For argument sake you don't treat these as bits sent. They are always there generated by the UART and has nothing to do with data transmitted.

#### Papabravo

Joined Feb 24, 2006
20,384
I'm a little confused what do you mean by synchronous limit mean?

USART has two modes asynchronous and synchronous.

Isn't 10 bits frame sent on bus to send 1 byte data in asynchronous mode ?
I'm only talking about the asynchronous mode. If you measure the data rate in bytes per second, there is a limit to how many bytes you can fit into one second. If you went faster then that you would be reducing the length of the framing bits or you would be reducing the length of all bits. Neither one of those things would allow for reliable communication. Normally in asynchronous communications there are bursts of characters with long periods in between. In keyboards it is not uncommon for single characters to be sent with long delays between characters. A computer can send characters to a printer at or near the synchronous limit with relative ease. Embedded processors can also accomplish this for much higher bit rates than 9600 bits/second.

#### Sparsh45

Joined Dec 6, 2021
143
Thanks for help i have one more confusion. I understand that uart protocol can be followed between two devices if both have uart hardware circuit.

Let's say data is being sent from the micro to PC and there is a USB to RS232 converter between the two,
if micro has inbuilt uart peripheral.
Where should be the other uart peripheral? inside PC or in RS232 converter.?

I think the other uart peripheral should be inside the PC, Not in inside the converter

Last edited:

#### MrChips

Joined Oct 2, 2009
29,217
USB to UART converter is a different story altogether.

microcomputer <-> UART-to-USB bridge <-> USB port on PC

A USB port is not a UART and does not use UART protocol. This is very complex which we will not discuss here.

The UART hardware is in the MCU. It uses UART protocol to communicate with a UART-to-USB bridge. This is hardware IC that could reside in the MCU but is often installed in the communications cable, such as FTDI FT232 or Silicon Labs CP2102.
The bridge accepts the UART protocol and converts it to USB protocol. The UART baud is established by the MCU and bridge software. There is no equivalent data rate on the USB side, which has to confirm to the USB standard, i.e. USB, USB2, USB3, etc.

#### Sparsh45

Joined Dec 6, 2021
143
USB to UART converter is a different story altogether.

microcomputer <-> UART-to-USB bridge <-> USB port on PC
Is this UART-to-USB bridge ? https://quartzcomponents.com/produc...hjFDaRzW8ItopP6VtlvHyxdKVGddu7axoCAk4QAvD_BwE

cable https://m.snapdeal.com/product/bafo...PUo_K9rDa_gZ_hsuGM6fT1U9WudwtPWxoCTHsQAvD_BwE

A USB port is not a UART and does not use UART protocol. This is very complex which we will not discuss here.
I'm a bit surprised because as far as I know both devices should have supported uart only then uart protocol can be followed

#### Papabravo

Joined Feb 24, 2006
20,384
The typical PC has not supported a direct UART interface for about 2 decades or more. The original IBM PC (ca. 1981) certainly did, but it fell out of favor. The reasons are many and varied, and worthy of their own thread. The UART to USB bridge is there for the express purpose of making things easier for the PC and easier for the peripheral devices for which a full USB interface might be overkill.

#### djsfantasi

Joined Apr 11, 2010
9,079
A UART is NOT a communications protocol.

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.

#### Sparsh45

Joined Dec 6, 2021
143
In what mode does the general UART work half duplex or full duplex?

The reason for the confusion is that in many places it is called full-duplex and in many places it is called half-duplex.

It seems to me that the uart works in half-duplex mode because It is one way communication, it can send or receive data at a time. It can't send and receive data at same time.

What do you think, Is it full-duplex or half-duplex?

Last edited:

#### Papabravo

Joined Feb 24, 2006
20,384
In what mode does the general UART work half duplex or full duplex?

The reason for the confusion is that in many places it is called full-duplex and in many places it is called half-duplex.

It seems to me that the uart works in half-duplex mode because It is one way communication, it can send or receive data at a time. It can't send and receive data at same time.

What do you think, Is it full-duplex or half-duplex?
A UART can work in either half-duplex or full-duplex. The receiver and transmitter are independent modules that can both be performing their function at the same time.

#### Sparsh45

Joined Dec 6, 2021
143
A UART can work in either half-duplex or full-duplex. The receiver and transmitter are independent modules that can both be performing their function at the same time.
But when I see the code of UART, I see only one character can be sent or received at that time.

https://exploreembedded.com/wiki/Serial_Communication_with_PIC16F877A

Does UART hardware work in full / half duplex mode while UART code works in half duplex?

#### MrChips

Joined Oct 2, 2009
29,217
Generally, UART hardware can run in full duplex, i.e. it can transmit and receive at the same time.
It is up to the system software to decide if it wants to run in full duplex or half duplex.

When you look at the code you cannot tell if it is running in full or half duplex. You may think that the code cannot send and receive at the same time. That is not true. What the code is doing is not the same thing as what the hardware is doing. While the code is sitting waiting for an event to happen, the HW can still be sending and receiving at the same time.

In particular, you can transmit and receive without loss of data by running the HW in interrupt mode. Data being transmitted and received can be handled using data buffers while the SW is doing something totally unrelated to UART operations.

#### Papabravo

Joined Feb 24, 2006
20,384
But when I see the code of UART, I see only one character can be sent or received at that time.

https://exploreembedded.com/wiki/Serial_Communication_with_PIC16F877A

Does UART hardware work in full / half duplex mode while UART code works in half duplex?
You can tell what is going on in the code by looking at the big picture. You know that it takes 10 bit times to send and receive a complete character. You have to ask yourself what is your code doing while the hardware is working on sending and receiving characters. If it is NOT waiting around for the completion of each operation then full duplex is going on.

One more thing. In order for full-duplex to be possible there need to be separate transmit and receive circuits as there are in RS-232. Using RS-485 there may or may not be separate circuits. Details are important

#### Sparsh45

Joined Dec 6, 2021
143
Generally, UART hardware can run in full duplex, i.e. it can transmit and receive at the same time.
It is up to the system software to decide if it wants to run in full duplex or half duplex.
Like in i2c communication multiple slave devices can be connected to i2c bus, can UART do the same ?

I don't think multiple slaves can be contacted to UART bus. because it will be difficult to identify each slave in uart communication.

RS233

#### MrChips

Joined Oct 2, 2009
29,217
Like in i2c communication multiple slave devices can be connected to i2c bus, can UART do the same ?

I don't think multiple slaves can be contacted to UART bus. because it will be difficult to identify each slave in uart communication.

RS233
Totally incorrect. I have driven 4-axis controllers from a single UART connection.

#### ericgibbs

Joined Jan 29, 2010
18,007
hI,
Remote RX Slaves for receiving ONLY can be connected to a Master Transmitter
E