Serial Communication

Communication is an activity that everyone does daily. To communicate is to send (transmit) or receive the data (information) between two or more sides. In the electronic world, communication is done in certain ways. The protocol regulates it. A protocol consists of a set of rules that ensure a secure and reliable communication process.

In this article, we are trying to explain the serial communication running in our daily life without us being aware. The most familiar serial communication that we often encounter is the USB connection. To get more knowledge about it, the article is here meant for you.

What is Serial Communication?

Serial communication is a method to send or data one bit at a time in the form of binary pulses. The binary means that zero represents 0 volt or a logic LOW while one represents 5 volts or a logic HIGH. Based on the transmission modes, the serial communication can be classified as below:

1. Simplex Mode

It is a one-way communication method. It means that either the receiver or transmitter is active at a time. When the transmitter is sending the data7, the receiver just accepts it. It can be found in the Radio and Television transmission. The keyboard and monitor are also examples of the simplex mode.

Simplex Mode

2. Half-Duplex Mode

This transmission mode allows the transmitter and sender to be active but not at a time. It also can be said that it is a two-way communication method but one activity at a time. If the transmitter is sending the data, then the receiver can only accept it. On the other hand, if the receiver is sending the data, then the transmitter can only accept it. The Walkie-Talkies is a simple example of half-duplex mode.

Half Duplex Mode

3. Full-Duplex Mode

The full-duplex mode is a mode when both the transmitter and receiver can send and receive the data simultaneously. To put it simply, it is a two-way communication method simultaneously. The smartphone or a phone unit is an easy example we can find.

Full Duplex Mode

In terms of performance level, the simplex mode provides the least performance out of those three. While the half-duplex is in the middle, the full-duplex provides the best performance.

Serial Vs. Parallel Communication

Aside from serial communication, we know that there also exists parallel communication to transmit the data. The below table will help you to get a better understanding of the differences between the two.

Serial CommunicationParallel Communication
–        Low-cost production–        High-cost production
–        Sends data one bit at a time–        Sends a group of data at a time
–        One wire data transmission–        “N” wire number of ‘n’ bits data transmission
–        Low speed–        High speed
–        Suitable for distant communication–        Suitable for near communication
–        Example: PC to PC, Microcontroller to microcontroller–        Example: PC to a printer, HDMI, DVI, and PCI

How does Serial Communication Work?

The serial communication transmits one bit of data at a time. It means that less input-output (I/O) is needed so that less space is required and more cross-talk resistance. It all leads to the cheaper cost of the overall embedded system and makes it suitable for long-range communication. The illustration below depicts the simplicity of how serial communication works.

From the picture, we know that the clock plays an important role in serial communication. When the clock is troubled, it can affect the data transmission. On the other hand, serial devices have different clock signals. The next section is going to explain more about the categorization based on the clock signals.

Serial Communication Types

The different clock signal that the serial devices require, leads to categorizing the synchronization protocols into the synchronous protocol and asynchronous protocol.

1. Synchronous Serial Interface

The synchronous serial interface means that the devices both master and slave use a single bus to transmit the data and clock. This means that there are advantages to using this interface type. Using the same bus makes the data transmission faster. In the baud rate, there will be no mismatch.

  • On the transmitter side: because there is no start, stop, and parity bits added to data, then there is a data shift onto the serial line.
  • On the receiver side: the data extraction is done by using the clock from the transmitter then it is converted back to the parallel form.

The best known of this type are SPI and I2C.

These are the protocols that use synchronous serial interface:

SPI Protocol

SPI stands for Serial Peripheral Interface. It allows several microcontrollers with SPI features to connect one another in a master-slave relationship. A typical SPI has four pins to interconnect such as MISO (Master In Slave Out), MOSI (Master Out Slave In), SCK (Serial Clock), and SS (Slave Select). A common microcontroller will have SPI pins to connect to other microcontrollers.

a. Advantages

    • Ideal for high-speed data communication (up to 10Mbps)
    • Configurable master-slave status
    • Can have unlimited slave number

b. Disadvantages

    • It needs more wiring (6 wires) than the I2C

SPI Protocol

I2C Protocol

I2C is the inter-integrated circuit using two-wires communication between various ICs or modules. The two lines are SCL (Serial Clock) and SDA (Serial Data Address). It could connect up to 1024 peripherals as it uses 7-bits or 10-bits addressing system to pinpoint the specified device on the I2C bus. A typical modern microcontroller mostly has I2C pins to communicate.

a. Advantages

    • Ideal for onboard communication
    • Fewer wires required (2 wires) than SPI
    • Easy to setup

b. Disadvantages

    • Its speed (400Kbps) is slower than SPI
    • Limited connectible devices as it uses a 10 or 7-bits addressing system.

I2C Protocol

USB

Universal Serial Bus (USB) is a protocol with a wide application implementation and easy to use. This protocol present in almost every electronic device such as cameras, smartphones, keyboards, printers, and scanners. Also, we utilize it in the data logging activity from a measuring instrument to a PC. Due to its size and speed, it replaces the slower and bulkier serial and parallel interfaces.

a. Advantages

    • Easy to use and wide application coverage area
    • Less interference
    • Smaller size
    • Available at low cost
    • Supports various speeds (1.5Mbps for USB v1.0, 480Mbps for USB v2.0, and 5Gbps for USB v3.0)

b. Disadvantages

    • Limited USB connection cable that is 5 meters as per its standards. You need an USB hub to extend the distance.
    • It does not have a broadcasting feature.

USB protocol

CAN

Controller Area Network (CAN) is a serial communication type that was initially created for the automotive industry. It provides a durable and cheap network that helps multiple field devices communicate with each other. It deletes the need for single and separate analog and a digital input for every device in a system.

a. Advantages

    • 1 Mbits/sec data rates up to several kilometers
    • Excellent error detection and confinement capabilities
    • Helps multiple field devices communicate with each other

b. Disadvantages

    • High software development and maintenance cost
    • Possibility of undesired interaction

CAN protocol

Microwire

It is a subset of SPI with different timing and latching of data. Also called a 3-wire interface because of the 3 lines that are SI as the serial input line to the microcontroller, SO as the serial output line, and SK as the serial clock.

a. Advantages

    • 3Mbps full duplex
    • 3-wire interface

b. Disadvantages

    • Slower clock rates than newer SPI versions

JTAG

It stands for Joint Test Action Group and is an industry-standard to verify designs and test printed circuit boards. This standard is implemented as a tool to complete the digital simulation for on-chip instrumentation.

a. Advantages

    • Less debugging time
    • Cost-effective production
    • Strengthened product quality

b. Disadvantages

    • Good software is required to make use of all of its features

2. Asynchronous Serial Interface

In this interface type, there is no external clock signal. It is mostly found in long-range communication and best for stable communication. This interface relies on the parameters such as Baud Rate, Data bit selection (Framing), Synchronization, and error-checking.

The following is a brief description of the said parameters:

a. Baud Rate: it defines the data transfer rate from the transmitter to the receiver and it is measured in bps (bits per second unit) unit. The well-known baud rates are 1200, 2400, 4800, 9600, 57600, 115200. The most used is the 9600 baud rate. The higher the baud rate is, the faster the data transfer is. Both the transmitter and receiver sides must have the same baud rate.

b. Framing: It is the length of data bits that are about to be sent by the transmitter to the receiver. The 8-bits format is the most used. However, different applications use different data bits.

c. Synchronization: it is the process to determine the start and the end (stop) of the data bits. The transmitter attaches the start and the stop bits to the data frame and the receiver identifies it respectively.

d. Error Control: an error could happen due to the noise while the data is being transferred. The error control is the solution to get the stable output by checking the “Parity”. Even parity is when the binary data have the even numbers of “1” and the parity bit is set to “1”. On the other hand, odd parity is when the binary data has the odd number of “1” and the parity bit is set to “0”.

These are the protocols that use asynchronous serial interface:

RS-232

The name is after Recommended Standard 232 and was publicly introduced back in 1960 for serial communication. It is mainly applied to connect a computer and peripheral devices to enable serial communication on daily use.

a. Advantages

    • Widely used between DTE (Data Terminal Equipment) and DCE (Data Circuit-terminal Equipment) devices
    • Error correction capabilities and long-distance support (about 50 feet with low baud rates)
    • Due to the use of binary logic, it is immune to noise

b. Disadvantages

    • Sensor to IC or IC to IC communication is not suitable to use RS 232
    • More separate transceiver ICs required means more cost
    • Mainly for single master – single slave configuration, not for single master – multiple slaves configuration

RS-422

It is basically the improved version of RS-232.

a. Advantages

    • Up to 10Mbps data rates
    • Possible distance between 50 feet and 4000 feet with 100 Kbps
    • More resilient to common interference due to the use of differential transceivers

b. Disadvantages

    • Fewer devices support RS-422 so the converter is pretty much required

RS-485

It causes much confusion in public because of its similarity to RS-422. It is a 2-wire system in general while RS-422 is a 4-wire system (which is similar to far less common 4-wire system RS-485).

a. Advantages

    • Supports multipoint systems
    • Most widely used in telecom, industrial, and POS applications
    • Due to the wide common mode, data transmission over longer cable is possible in such a high noise place i.e. the factory floor
    • Easier pinout wiring

b. Disadvantages

    • More difficult to program RS-485
    • It requires a special cable to run
    • System back-up is difficult to do since the need to build a redundant host PC

UART & USART

UART stands for Universal Asynchronous Receiver/Transmitter. While USART stands for Universal Synchronous Asynchronous Receiver/Transmitter. For your information, both are not a communication protocol such as I2C and SPI, but a circuit in an integrated circuit or a microcontroller.

How UART works

How UART WorksA device like a CPU will use the data bus to send the data to the UART. The data is still in parallel form upon being received by the UART. It is then converted to a serial form by the transmitting UART in order to be sent via serial communication. On the receiving UART side, the serial data is converted back into parallel form for the next process. The full-duplex mode is used in this mode.

a. Advantages of UART

    • Only requires two wires which save cost for wires
    • No clock signal required
    • Less complex than USART
    • Variable data transfer rate

b. Disadvantages of UART

    • Only asynchronous mode available
    • Slower than USART
    • The receiver must recognize the transmitter’s baud rate
    • How USART works

How USART WorksThe half-duple mode is used in this transmission mode. The data signals are transmitted in the blocks form. To operate, it needs clock and data signals. It can do the asynchronous mode just like the UART. However, it is more complex than UART. The baud rate information has been included in the data stream so that receiver does not need to know the baud rate. The data transfer rate is at a definite rate in USART.

c. Advantages of USART

    • Faster data transfer rate than UART
    • Can do the asynchronous transmission mode
    • The receiver does not have to know the baud rate of the transmitter

d. Disadvantages of USART

    • Fixed data transfer rate
    • Need Clock to operate means more wirings

SBUS & PPM

SBUS is a Serial BUS that is used commonly by FrSKy and Futaba. There is only a single necessary signal wire to support up to 16 channels. You have to connect the RX pin of UART to the SBUS.

a. Advantages of SBUS

    • SBUS is faster than PPM
    • One wire only for 16 channels

b. Disadvantages of SBUS

    • Less common than PPM

PPM (Pulse Position Modulation) known also as CPPM or PPMSUM signal is a PWM signal series transmitted one after another on the same wire and differently modulated. Both SBUS and PPM are receiver protocols. While PPM is an old and analog signal, SBUS is a new and digital signal.

c. Advantages of PPM

    • Universal
    • One wire only for 8 channels

d. Disadvantages of PPM

    • Slower than SBUS

MIDI

The Musical Instrument Digital Interface is a simple serial communication protocol that acts to connect devices that make and control sound like synthesizers, samplers, and computers so that communication is established among them via MIDI messages.

The picture above represents the circular 5-pin DIN connector of MIDI.

a. Advantages

    • Easy to modify and manipulate
    • Small file size
    • Rich choice of synthesizers, electronic instruments, or digitally sampled sounds

b. Disadvantages

    • Replaced by USB in the simple setup

Summary

In instrumentation, learning about serial communication is important. When designing a certain measuring instrument, you have to know what communication model is being used by the display or sensor. That way, you know what to set up. If you have no idea of what communication type your instrument components use, your instrument won’t work.