PV198 Study Materials

Preliminaries

Theory

- Introduction

- GPIO

- Interrupts

- Timer

- PWM

- ADC

- Communication buses

- SPI

- I2C

- UART

Practical

UART

UART - Universal Asynchronous Receiver-Transmitter is another common way of communication. The use case that stands out is communication between the MCU and PC.

Properties

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.

Pins

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:

UART wires

MCU-to-PC

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.