Understanding serial protocols

Oscilloscope and probe fundamentals

Understanding serial protocols

Transferring digital data: Parallel vs. serial transmission

Digital systems are based on the concept of bits, that need to be transferred between two components or devices. There are many ways of moving bits, but the different methods of transferring bits can be separated into two main categories: parallel and serial transmission.

Parallel transmission

Parallel transmission moves multiple bits simultaneously between transmitter and receiver, usually with a separate conductor per bit. Parallel connections work well for short-distance and/or point-to-point connections. They have simple timing and are relatively easy to analyze. But as popular as parallel transmission once was, it’s now largely being replaced by serial transmission.

Serial transmission

As the name implies, serial transmission sends one bit at a time, with all the bits being sent over the same conductor. Serial transmission works well for longer-distance applications, applications needing higher throughput, and applications where there are multiple nodes. All of this comes at a cost, with serial transmission being more complex and harder to analyze. While it is true that data bits are being sent over a single conductor or “wire,” most serial protocols use multiple conductors.

In addition to the wire for the data bits, many protocols also add a clock signal, some type of control or addressing function for multiple nodes.

Parallel transmission

Serial transmission

Serial protocol examples

Serial protocols are used in a very wide variety of applications. The three main serial protocols used for generic applications are UART , I²C and SPI.

A special category of serial protocols are those used in the automotive industry, such as CAN, LIN and FlexRay. These protocols were designed to deal with the challenging requirements of vehicles, such as providing reliable operation at a mix of both low and high speeds and in a noisy environment.

Generic applications

UART (Universal Asynchronous Receiver/Transmitter)

  • Classic serial protocol
  • easy to implement
  • has been used in PC serial and COM ports for decades

I²C (Inter-IC)

  • Communication between integrated circuits (and more)

SPI (Serial Peripheral Interface)

  • Higher Speed than I²C
  • uses more wires and is generally more complex

Automotive applications

CAN (Controller Area Network)

  • High Speed
  • often used with sensors

LIN (Local Interconnect Network)

  • Lower speed
  • used with accessories (e.g. windows, mirrors)

FlexRay

  • Higher speed with redundancy

Characteristics of serial protocols

Although implementation details differ between protocols, all serial protocols have four basic characteristics, which are also important for the analysis and decode of serial data:

  • Levels: how voltages are used to represent zeros or ones
  • Timing: how often bits are sent (bit time)
  • Framing: how bits are organized into groups and the role of each bit or group of bits
  • Protocol: which messages are exchanged under which circumstances

Levels

Before doing any kind of digital decode, we need to be able to tell the ones and zeros apart. In other words, how are bit values determined from voltage levels? A simple approach would be to define that a “low” voltage equals zero and a “high” voltage equals one. In fact, this is how some serial protocols work.
Serial protocols used in challenging environments, such as automotive, often use a differential voltage, since differential signals tend to be more immune to noise. Differential means that a 0 or 1 is defined based on the difference between two voltages, rather than with respect to ground.

Note: Differential probes are very helpful for these measurements.

Timing

Defining the “0” and “1” voltage levels is not enough to determine what bits are receiving. Additionally, it is important to understand how fast the bits are being generated, or in other words, what the “bit time” or “bit rate” is.
In order to decode serial data, the receiver or instrument is must use the same bit rate as the transmitter.

Framing

Serial protocols typically organize bits into so-called frames. The individual bits or groups of bits in the frame have defined meanings. To decode frames correctly, some knowledge of this structure is needed.
For example, when decoding the UART serial protocol it is important to know that the idle state of the line is a high voltage level. A transition from high to low is a “start bit” indicating the start of the frame. Besides, it is necessary to understand how many data bits to read, as well as the fact that there is a high-voltage level stop bit that ends the frame, followed by a return to the idle state. By knowing the frame structure, the user data can be extracted from the serial bit stream, as well as derive other information about the transmission.

Bits are usually organized into “frames”; Each bit or group of bits in a frame has a defined meaning

Protocol

The last aspect to consider can be called “protocol”. A generic definition of protocol is a set of rules for encoding and exchanging information. There can be rules for how and when data is sent, and the types and meanings of messages exchanged between endpoints.
A simple protocol would be to send data as soon as it’s available, regardless of whether the receiver is ready for the data or not. A more sophisticated protocol would be to use some mechanism to ask for permission before sending data. An even more sophisticated protocol would involve the sender waiting for an explicit acknowledgement that data was correctly received before sending more data or resending missing or errored data.

Decoding serial protocols

In the past, serial protocols were typically decoded using special dedicated protocol testers. Today the most common method is using a modern digital storage oscilloscope , with one or more channels. After choosing the serial protocol of interest, the levels, timing and framing must be configured to match the analyzed serial signal. Using this information, the oscilloscope produces results in the form of raw voltage levels, detected bits, and frames whose contents can be displayed in binary, hex or ASCII. Serial decoding on oscilloscopes also often includes additional functionality such as triggering on specific symbols within the frame, assigning humanly readable labels to user-defined patterns and exporting data.

Understanding serial protocols

Watch our video "Understanding serial protocols" to learn more

This video explains the basic technical overview of serial protocols and how protocol messages are decoded and analyzed using an oscilloscope.

Summary

Serial protocols are used to move bits sequentially, or one at a time, between components or between separate devices.

Serial communications are used in almost every digital device

Serial protocols can be divided into:

  • generic standards like UART, I²C and SPI
  • more application-specific protocols like CAN, LIN, and FlexRay (primarily used in automotive)

All serial protocols have certain characteristics, such as:

  • how voltages are mapped into bits,
  • the timing or bit rate,
  • how bits are organized into message units, or fames, as well as
  • the types of frames exchanged and the rules for when each type of frame is sent.

Modern digital oscilloscopes are now the tool of choice for analyzing and decoding serial data.

Do you have any questions about serial protocols or the decoding of serial protocols? Our experts will help you.