UART
- U
niversal A
synchronous R
eceiver-T
ransmitter is another common way of communication.
The use case that stands out is communication between the MCU
and PC
.
UART
is serial
, asynchronous
, commonly full-duplex
, and point-to-point
.
That is, the UART
is used only between two
devices.
It lacks a clock wire for synchronization, uses one wire for each direction of communication.
The data is transferred in frames
that contain the start bit
, configured number of bits
, parity bits
, and stop bits
.
(Common settings are 8 bits
of data, no parity
, and 1 stop bit
)
Baudrate
specifies the rate of data transfer - bits per second
.
This includes all the bits of the frame
.
In the case of UART
, we do not name the wires but rather the pins
on the devices.
Each device has TX
and RX
pins, that refer to transfer
and receive
respectively.
Let’s name the devices A
and B
:
RX
of A
is connected to TX
of B
TX
of A
is connected to RX
of B
Let’s discuss the MCU-to-PC
interaction in more detail.
On the side of the MCU
, the entire interaction is just standard UART
usage.
On the side of the PC
, we need support for UART
.
Historically, PC
had native support.
Today we mostly rely on USB-to-UART
adapters, as they are commonly available.
The device is visible as a virtual serial port
in the OS
.
On a Linux system, this looks like a standard file that can be read from, or written to.