Serial Communication Protocols: UART, SPI, I2C
Tags: serialcommunication, uart, spi, i2c
Published: 2023-10-24 01:29:59

In the embedded system dom, serial communication is the most widely adopted method for data transmission between devices and peripherals. What is behind its popularity? And Which generic serial communication protocols should an embedded system engineer master? Allow RF-star to explain.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ay2n3xsdurmte2hh2e7.jpg)
Serial Communication Protocols UART SPI I2C&Bluetooth UART Modules

## What is Serial Communication?
In terms of baseline methodology, data transmission protocols can be generally classified into two categories: parallel protocols and serial protocols.

Serial protocols use one or two transmission lines for bits transmission and reception. Bits are transmitted one by one in a sequential manner over the computer bus or communication channel. Whereas, parallel protocols, trans and receive bits with several parallel channels simultaneously.

**The [serial communication protocol](https://www.rfstariot.com/serial-port-_c0_ss) is a simple and reliable way of communication with rules followed by the sender and receiver. Three common examples of serial communication protocols are used in a very wide variety of applications.**

## Serial Communication Examples: UART, SPI, I2C
The main types of serial communication protocols are UART, SPI, and I2C.

## What is UART?
UART, or universal asynchronous receiver/transmitter is one of the earliest and the simplest serial protocols for exchanging serial data between two devices. The asynchronous communication protocol uses only two wires, namely the transmit (TX) and receive (RX) lines, to transmit and receive data. 

Devices connected through UART communicate by sending bits at a predetermined baud rate, often including start, stop, and optional parity bits. UART devices don't use a shared clock signal. Instead, they must agree on the baud rate and data format.

Many developers use UART for wireless connection and computer processing because of its easy setup, user-friendly interface, and affordability.

## What is SPI?
SPI stands for Serial Peripheral Interface, a serial communication protocol often used in embedded systems for high-speed data exchanges between multiple devices on the bus. Devices communicating via SPI are in a master-slave architecture with multiple slave devices connected to a single master device. Additionally, SPI communication supports full-duplex communication, meaning that both the master and slave can transmit and receive data simultaneously. 

Unlike other communication protocols like UART or I2C, SPI does not have a pre-defined protocol and no fixed communication parameters. This flexibility makes SPI ideal for data-streaming applications that require real-time or high-bandwidth data communication. 

Click here to get more information about [UART and SPI interfaces](https://www.rfstariot.com/blog/quick-understanding-of-universal-peripheral-interfaces-in-embedded-systems-chapter_b46).

## [What is I2C](https://www.rfstariot.com/universal-peripheral-interfaces-what-is-i2c-adc-can-bus_n195)?
I2C (short for Inter-Integrated Circuit), alternatively known as I2C or IIC, is a synchronous, multi-master/multi-slave serial communication bus. It is a bidirectional two-wire serial bus that uses serial clock (SCL) and serial data (SDA) wires to send and manage data bit by bit between multiple devices. With I2C, multiple slaves can be connected to a single master (like SPI) and multiple masters can control single, or multiple slaves. 

I2C offers extreme scalability and flexibility in connecting numerous devices. However, it does have a few disadvantages. It operates at a slower speed compared to SPI, and the clock and data lines require pull-up resistors. I2C also involves more complex logic and error handling, as well as potential issues such as bus contention and noise interference.

Which is the best serial communication protocol, UART, SPI, I2C? Unfortunately, there is no definitely optimal serial communication protocol as each one has its own merits and drawbacks. The table comparing UART, SPI, and I2C, SPI communication shows directly their various advantages, disadvantages, and functions to help you easily pick the feasible communication.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wh16v4qlzx0x7qj3tpmb.png)
Comparison of UART, SPI, and I2C, SPI communication

If you are confused to choose a suitable serial protocol, these tips are recommended as follows:

- When you prioritize data transfer speed, SPI would be the fastest serial communication protocol.
- If the wireless communication is to connect multiple devices while keeping the setup relatively simple, I2C would be a preferred choice. 
- If your project only inclines to transfer data transparently between two devices, UART is the simplest and most cost-effective solution, especially for applications with limited hardware resources.

## Examples of Bluetooth UART Modules
**RF-star wireless module uses 2.4GHz serial port technology and can have transparent transmission communication with UART protocol provided to transmit data simultaneously. Moreover, the rich AT commands enable you to shorten the development time and accelerate the end product to release.**

Here are the high-quality [Bluetooth UART modules](https://www.rfstariot.com/UART_c0_ss) listed.

## CC2340R5 Series Wireless RF Modules
RF-BM-2340Xx series wireless RF modules are all based on CC2340R5 SimpleLink wireless MCUs, supporting Bluetooth 5.3 Low Energy, ZigBee 3.0, SimpleLinkTM TI 15.4-stack, and Proprietary system. All RF-star [CC2340R5 modules](https://www.rfstariot.com/CC2340R5_c0_ss) are embedded with BLE5.0 UART transparent transmission protocol. In addition, the CC2340R5 serial port modules with multiple extensive antenna versions (eg. PCB, IPEX, Chip), featuring different dimensions. They are well-suited for portable medical, automobile, new energy, industrial, and consumer electronics applications.

## CC264x Series Bluetooth Low Energy Modules
RF-star CC264x Series BLE Modules embedded with TI CC2642R and CC2640R MCUs are also pre-programmed with BLE5.0 UART transparent transmission protocol. The difference lies in the role of CC2640R and CC2642R. In UART protocol, the CC2642R Bluetooth Low Energy modules RF-BM-2642B1 and RF-BM-2642B2 can support master-slave mode at the same time, while CC2640R low power Bluetooth modules can operate as either a master or a slave device, depending on the application requirements. Due to their stable performance and low cost, CC264x series modules have been highly recognized in the field of advertising, direction finding, and Bluetooth mesh networks.

## EFR32BG22 Series Bluetooth LE5.3 Modules
The [EFR32BG22 series modules](https://www.rfstariot.com/bg22_c0_ss) based on Silicon Labs BG22 SoCs support BLE 5x low energy, BLE mesh, AoA / AoD, and proprietary protocol. They are all pre-programmed with **a serial port communication protocol (UART) and I2C communication protocol**. They can communicate as multiple masters and slaves simultaneously. The multi-connection function, best-in-class ultra-low power consumption, and rich AT commands functions enable the BLE master-slave modules flexible and scalable in various applications.

## nRF52 Series BLE Modules
RF-star nRF52 series BLE modules cover these wireless RF modules based on Nordic nRF52810 and nRF52832 integrated chips. The nRF52810 RF-BM-ND04Cx and RF-BM-ND08Cx modules can operate only as a slave device in BLE5.0 UART transparent transmission protocol. Instead, the nRF52832 RF-BM-ND04x and RF-BM-ND08 modules are designed as [master-slave Bluetooth modules](https://www.rfstariot.com/robust-size-ble-5-0-module-based-on-nordic-ble-soc-nrf52832-rf-bm-nd08_p16.html), even operating as a master and multiple slaves. The nRF52840 series multi-protocol modules have been already embedded with BLE5.0 serial port (UART) protocol.

## Summary
RF-star wireless modules, especially Bluetooth Low Energy modules are integrated with BLE UART transparent transmission protocol. The serial port modules will help your end products easily and directly communicate in the embedded systems. If your project requests a SPI or I2C communication, RF-star is pleasure to offer a customized wireless communication solution.