
Before starting with Serial Communication Protocols, let’s break down the terminology into three parts. Communication is a very well-known terminology that involves the exchange of information between two or more mediums. In embedded systems, communication means the exchange of data between two microcontrollers in the form of bits. This exchange of data bits in a microcontroller is done by a set of defined rules known as communication protocols. Now, if the data is sent in series, i.e., one after the other, then the communication protocol is known as Serial Communication Protocol. More specifically, the data bits are transmitted one at a time in a sequential manner over the data bus or communication channel in Serial Communication.
Types of Serial Communication Protocols in Embedded Systems
There are different types of data transfer available in digital electronics, such as serial communication and parallel communication. Similarly, the protocols are divided into two types such as Serial Communication Protocol and Parallel Communication Protocols. Examples of Parallel Communication Protocols are ISA, ATA, SCSI, PCI, and IEEE-488. Similarly, there are several examples of Serial Communication Protocols such as CAN, ETHERNET, I2C, SPI, RS232, USB, 1-Wire, and SATA etc.
In this article, the different types of Serial Communication Protocols will be discussed. Serial communication is the most widely used approach to transfer information between data processing peripherals. Every electronics device, whether it is a Personal Computer (PC) or a Mobile, runs on serial communication. The protocol is a secure and reliable form of communication having a set of rules addressed by the source host (sender) and destination host (receiver), similar to parallel communication.
Transmission Modes in Serial Communication
As already said above that in serial communication, data is sent in the form of bits, i.e., binary pulses, and it is well known that, binary one represents the logic HIGH and zero represents the logic LOW. There are several types of serial communication depending on the type of transmission mode and data transfer. The transmission modes are classified as Simplex, Half Duplex, and Full Duplex.
Simplex Method:
In the simplex method, either of the medium i.e sender or the receiver, can be active at a time. So if the sender is transmitting the data, then the receiver can only accept, and vice versa. So simplex method is a one-way communication technique. The well-known examples of the simplex method are Television and Radio.
Half Duplex Method:
In the half duplex method, both sender and receiver can be active, but not at the same time. So if the sender is transmitting, then the receiver can accept but cannot send, and vice versa. The well-known example of the half duplex is the Internet, where the user sends a request for data and gets it from the server.
Full Duplex Method:
In the full duplex method, both the receiver and the transmitter can send data to each other at the same time. The well-known example is a mobile phone.
Apart from this, for appropriate data transmission, the clock plays an important role and it is one of the primary source. Malfunction of the clock results in unexpected data transmission, even sometimes data loss. So, the clock synchronisation becomes very important when using serial communication.
Clock Synchronization
The clock is different for serial devices, and it is classified into two types, viz. Synchronous Serial Interface and Asynchronous Serial Interface.
Synchronous Serial Interface:
It is a point-to-point connection from a master to a slave. In this type of interface, all the devices use a single CPU bus to share data and the clock. The data transmission becomes faster with the same bus to share the clock and data. Also, there is no mismatch in baud rate in this interface. On the transmitter side, there is a shift of the data onto a serial line providing the clock as a separate signal, as there are no start, stop, and parity bits added to the data. On the receiver side, the data is being extracted using the clock provided by the transmitter and converted the serial data back to parallel form. The well-known examples are I2C and SPI.
Asynchronous Serial Interface:
In an asynchronous Serial Interface, the external clock signal is absent. The Asynchronous Serial Interfaces can be seen mostly in long-distance applications and are a perfect fit for stable communication. In asynchronous Serial Interface, the absence of an external Clock Source makes it rely on several parameters such as Data Flow Control, Error Control, Baud Rate Control, Transmission Control, and Reception Control. On the transmitter side, there is a shifting of parallel data onto the serial line using its clock. Also, it adds the start, stop, and parity check bits. On the receiver side, the receiver extracts the data using its clock and converts the serial data back to the parallel form after stripping off the start, stop, and parity bits. The well-known examples are RS-232, RS-422, and RS-485.
Other Terms Related to Serial Communication
Apart from Clock Synchronization, there are certain things to remember when transferring data serially, such as Baud Rate, Data bit selection (Framing), synchronization, and error checking. Let’s discuss these terms briefly.
Baud Rate: Baud rate is the rate at which the data is transferred between the transmitter and receiver in the form of bits per second (bps). The most commonly used baud rate is 9600. But there are other selections of baud rate such as 1200, 2400, 4800, 57600, 115200. The more the baud rate will be faster the data will be transferred at a time. Also, for the data communication, the baud rate has to be the same for both the transmitter and receiver.
Framing: Framing refers to the number of data bits to be sent from transmitter to the receiver. The number of data bits differs in the case of the application. Most of the application uses 8 bits as the standard data bits, but it can be selected as 5, 6, or 7 bits.
Synchronisation: Synchronization Bits are important to select a chunk of data. It tells the start and end of the data bits. The transmitter will set start and stop bits in the data frame, and the receiver will identify it accordingly and do further processing.
Error Control: The error control plays an important role in serial communication, as there are many factors that affect and add noise in the serial communication. To get rid of this error, the parity bits are used, where parity will check for even and odd parity. So, if the data frame contains an even number of 1's, then it is known as even parity, and the parity bit in the register is set to 1. Similarly, if the data frame contains an odd number of 1's, then it is known as odd parity and clears the odd parity bit in the register.
A protocol is just like a common language that a system uses to understand the data. As described above, the serial communication protocol is divided into types, i.e., Synchronous and Asynchronous. Now both will be discussed in detail.
Serial Bus Communication Protocols
The synchronous type of serial protocols, such as SPI, I2C, CAN, and LIN, are used in different projects because it is one of the best resources for onboard peripherals. Also, these are the widely used Serial Bus Communication Protocols in major applications.
SPI Communication Protocol
The Serial Peripheral Interface (SPI) is a synchronous interface that allows several SPI microcontrollers to be interconnected. In SPI, separate wires are required for the data and clock lines. Also, the clock is not included in the data stream and must be furnished as a separate signal. The SPI may be configured either as a master or as a slave. The four basic SPI communication protocol signals (MISO, MOSI, SCK, and SS), Vcc, and Ground are part of data communication. So it needs 6 wires to send and receive data from the slave or the master. Theoretically, the SPI can have an unlimited number of slaves. The data communication is configured in SPI registers. The SPI can deliver up to 10Mbps of speed and is ideal for high-speed data communication.
Most of the microcontrollers have inbuilt support for SPI and can be directly connected to a SPI-supported device:
- SPI Communication with PIC Microcontroller PIC16F877A
- How to Use SPI Communication in STM32 Microcontroller
- How to use SPI in Arduino: Communication between two Arduino Boards
I2C serial communication protocol
Inter-integrated circuit (I2C) two-line communication between different ICs or modules, where two lines are SDA (Serial Data Line) and SCL (Serial Clock Line). Both lines must be connected to a positive supply using a pull-up resistor. I2C serial communication protocol can deliver speeds up to 400Kbps, and it uses a 10-bit or 7-bit addressing system to target a specific device on the I2C bus, so it can connect up to 1024 devices. It has limited length communication and is ideal for onboard communication. I2C networks are easy to set up since they use only two wires, and new devices can simply be connected to the two common I2C bus lines. Similar to SPI, microcontrollers generally have I2C pins to connect any I2C device:
- How to use I2C Communication in STM32 Microcontroller
- I2C Communication with PIC Microcontroller PIC16F877
- How to use I2C in Arduino: Communication between two Arduino Boards
USB
USB (Universal Serial Bus) is a widely used protocol with different versions and speeds. A maximum of 127 peripherals can be connected to a single USB host controller. USB acts as a "plug and play" device. The USB is used in almost all devices such as keyboards, printers, media devices, cameras, scanners, and mouse. It is designed for easy installation, faster data rates, less cabling, and hot swapping. It has replaced the bulkier and slower serial and parallel ports. USB uses differential signalling to reduce interference and allow high-speed transmission over a long distance.
A differential bus is built with two wires, one of which represents the transmitted data and the other its complement. The idea is that the 'average' voltage on the wires does not carry any information, resulting in less interference. In USB, the devices are allowed to draw a certain amount of power without asking the host. USB uses only two wires for data transfer and is faster than the serial and parallel interfaces. USB versions support different speeds such as 1.5Mbps (USB v1.0), 480 Mbps (USB 2.0), and 5Gbps (USB v3.0). The length of individual USB cables can reach up to 5 meters without a hub and 40 meters with a hub.
CAN
The Controller Area Network (CAN) is used in e.g. automotive to allow communication between ECUs (Engine Control Units) and sensors. The CAN protocol is robust, low-cost, and message-based, and covers many applications - e.g., cars, trucks, tractors, and industrial robots. The CAN bus system allows for central error diagnosis and configuration across all ECUs. CAN messages are prioritized via IDs so that the highest priority IDs are non-interrupted. Each ECU contains a chip for receiving all transmitted messages, deciding relevance, and acting accordingly - this allows easy modification and inclusion of additional nodes (e.g., CAN bus data loggers). The applications include the start/stop of vehicles, collision avoidance systems. The CAN bus systems can provide a speed of up to 1Mbps.
Microwire
MICROWIRE is a 3Mbps [full-duplex] serial 3-wire interface, essentially a subset of the SPI interface. Microwire is a serial I/O port on microcontrollers, so the Microwire bus will also be found on EEPROMs and other Peripheral chips. The 3 lines are SI (Serial Input), SO (Serial Output), and SK(Serial Clock). The Serial Input (SI) line to the microcontroller, SO is the serial output line, and SK is the serial clock line. Data is shifted out on the falling edge of SK, and is valued on the rising edge. SI is shifted in on the rising edge of SK. An additional bus enhancement to MICROWIRE is called MICROWIRE/Plus. The main difference between the two buses seems to be that the MICROWIRE/Plus architecture within the microcontroller is more complex. It supports speeds up to 3Mbps.
Asynchronous Serial Protocols
The asynchronous type of serial protocols is very essential when it comes to longer distances, reliable data transfer. Asynchronous communication does not require a timing clock that is common to both devices. Each device independently listens and sends digital pulses that represent bits of data at an agreed-upon rate. Asynchronous serial communication is sometimes referred to as Transistor-Transistor Logic (TTL) serial, where the high voltage level is logic 1, and the low voltage equates to logic 0. Almost every microcontroller on the market today has at least one Universal Asynchronous Receiver-Transmitter (UART) for serial communication. The examples are RS232, RS422, RS485 etc.
RS232 Serial Communication
The RS232 (Recommended Standard 232) is a very common protocol used to connect different peripherals such as Monitors, CNCs, etc. The RS232 comes in male and female connectors. The Arduino RS232 serial communication is a point-to-point topology with a maximum of one device connected and covers a distance up to 15 meters at 9600 bps. Information on the RS-232 interface is transmitted digitally by logical 0 and 1. The logical "1" (MARK) corresponds to a voltage in the range from -3 to -15 V. The logical "0" (SPACE) corresponds to a voltage in the range from +3 to +15 V. It comes in a DB9 connector, which has 9 pinouts such as TxD, RxD, RTS, CTS, DTR, DSR, DCD, and GND.
RS232 Serial Communication Implementation
Arduino RS232 serial communication requires careful voltage level conversion since Arduino operates at 5V logic levels while RS232 uses ±12V signals. Popular solutions include MAX232 IC-based level shifters or USB-to-RS232 adapters. The Arduino Serial library supports standard RS232 parameters, including baud rates from 300 to 115200 bps, making it compatible with most industrial RS232 devices.
Key Considerations for Arduino RS232 Serial Communication
- Voltage Level Conversion: Use MAX232 or a similar IC for proper signal levels
- Baud Rate Matching: Ensure both devices use identical baud rates (commonly 9600 bps)
- Pin Configuration: Connect TX to RX and RX to TX with proper ground reference
- Flow Control: Implement RTS/CTS handshaking for reliable data transfer
This implementation makes Arduino compatible with industrial equipment, CNC machines, and legacy computer systems that rely on RS232 interfaces.
RS422
The RS-422 is similar to RS232, which allows for simultaneous sending and receiving of messages on separate lines but uses a differential signal for this. In the RS-422 network, there can only be one transmitting device and up to 10 receiving devices. The data transfer speed in RS-422 depends on the distance and can vary from 10 kbps (1200 meters) to 10 Mbps (10 meters). The RS-422 line is 4 wires for data transmission (2 twisted wires for transmission and 2 twisted wires for receiving) and one common GND ground wire. The voltage on the data lines can be in the range from -6 V to +6 V. The logical difference between A and B is greater than +0.2 V. Logical 1 corresponds to the difference between A and B less than -0.2 V. The RS-422 standard does not define a specific type of connector; usually, it can be a terminal block or a DB9 connector.
RS485
Since RS-485 uses a multi-point topology, it is most commonly used in the industries and is an industry-preferred protocol. RS-422 can connect 32 line drivers and 32 receivers in a differential configuration, but with the help of additional repeaters and signal amplifiers, up to 256 devices. The RS-485 does not define a specific type of connector, but it is often a terminal block or a DB9 connector. The speed of operation also depends on the length of the line and can reach 10 Mbit / s at 10 meters. The voltage on the lines is in the range from -7 V to +12 V. There are two types of RS-485 such as half duplex mode RS-485 with 2 contacts and full duplex mode RS-485 with 4 contacts. To learn more about using RS-485 with other microcontrollers, check the links:
- RS-485 MODBUS Serial Communication using Arduino UNO as Slave
- RS-485 Serial Communication between Raspberry Pi and Arduino Uno
- RS-485 Serial Communication between Arduino Uno and Arduino Nano
- Serial Communication between STM32F103C8 and Arduino UNO using RS-485
Frequently Asked Questions
⇥ Which Serial Communication Protocol Types Are the Most Common?
The main types of serial communication protocols include synchronous protocols (SPI, I2C, USB, CAN) and asynchronous protocols (RS232, RS485, RS422). Synchronous protocols utilize a clock signal shared among devices, whereas asynchronous protocols rely on predetermined timing agreements between devices.
⇥ What Is the Process of RS232 Serial Communication?
RS232 serial communication uses voltage levels ranging from -15V to +15V to define logic states. Asynchronous data is transmitted with each byte framed by a start and stop bit. The protocol supports point-to-point communication that can reach up to 15 meters long at a 9600 baud rate.
⇥ How Do SPI and I2C Communication Protocols Differ From One Another?
In practical terms, a SPI communication protocol uses four wires (i.e., MOSI, MISO, SCK, SS) for full-duplex communication for speeds up to 10 Mbps, and an I2C serial communication protocol uses two wires (i.e., SDA and SCL) for half-duplex communication with a data speed of 400 kHz for standard mode. SPI is faster than I2C but uses more pins, whereas I2C supports multiple devices on the same bus.
⇥ Which serial communication protocol is best for Arduino projects?
The SPI communication protocol is best for high-speed sensors and displays in Arduino projects. The I2C serial communication protocol is best when multiple sensors can be on the same bus. The best choice for Arduino RS232 serial communication is be interfacing with industrial equipment and legacy systems.
Conclusion
Serial Communication is one of the widely used communication interface systems in electronics and embedded systems. The data rates can be different for different applications. The Serial Communication Protocols can play a decisive role when dealing with this kind of application. So, choosing the right Serial protocol becomes very important.