Feedback
Feedback

If you are having issues with the exercises, please create a ticket on DevZone: devzone.nordicsemi.com
Click or drag files to this area to upload. You can upload up to 2 files.

UART Protocol

UART is a peer-to-peer (P2P) hardware communication protocol where one end can be an MCU (microcontroller) and the other end can be another MCU, a sensor or a PC (through a USB-to-UART converter).

Note

All Nordic development kits have a USB-to-UART converter onboard to allow serial communication to a PC.

Data transfer is done serially. It starts with a starting bit, usually by driving logic low for one clock cycle. In the next n clock cycles, n bits are sent sequentially from the transmitter (n is usually 8). Optionally, 1 parity bit can be added to improve transfer reliability. In the end, the data wire is usually pulled up high to indicate the end of transfer.

Definition

Parity bit: A parity bit describes the evenness or oddness of the data and is a way for the receiver to tell if the data has changed during transmission.

UART timing diagram
Source: Wikipedia

UART has one connection pin for transmitted data, usually called TX, and another for received data, called RX. These connections are cross-coupled between a transmitter and a receiver. So the TX on one device is connected to the RX on the remote device and vice versa. GND stands for ground.

UART connection

The RX pin senses when a start bit has been initiated and automatically clocks in to store the new word. The data rate that the receiver and transmitter will operate at must be selected in advance; this is known as the baud rate. Common baud rate values for UART are 115200 or 9600 bits/s, or bauds.

UART Hardware Flow Control

UART hardware flow control is a technique that enables devices with different processing speeds to communicate reliably over a UART connection without data loss.

For instance, when Device A is transmitting a continuous stream of bytes to Device B, and Device B operates slower than Device A. In such situations, Device B can signal Device A to temporarily pause transmission, giving itself time to process the already received data, and free receive buffers. Flow control makes this possible by providing additional signals that instruct Device A to pause or resume data transmission as needed. These extra signals are called RTS (request to send) and CTS (clear to send).

UART connection with hardware flow control

These signals are interconnected between the two devices, where the RTS on one device connects to the CTS on the other, and vice versa. Each device writes its RTS to indicate readiness to receive new data, while it reads the CTS to determine whether it can send data to the counterpart device. A device maintains the RTS line asserted as long as it is prepared to accept additional data, and it will deassert RTS shortly before its receive buffer reaches capacity. Hardware flow control operates in both directions, meaning each device (Device A or Device B) can signal for a pause in transmission.

The UART peripheral on Nordic SoCs supports automatic hardware flow control, which is described in detail in the datasheet (product specification) of each SoC. In the Peripheals -> UART -> Transmission and Reception.

Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.