Low Speed Digital Interface Basics

Introduction

Inter-IC communication (IC-IC) has been established and evolved since the early days of electronic design. Several of these basic interfaces have stood the test of time and have been widely adopted across the electronics industry. We will examine a few basic and popular interfaces, such as I2C, SPI, and UART, that are used in almost any embedded system today.

Background

Digital communication largely fulfills two goals: sending instructions (i.e., control commands) and transferring data.

I/O Output Type

Data Transfer Structure

Data Transfer Technique


Detailed Interface Descriptions

I2C

Main Purpose

I2C (Inter-Integrated Circuit) is a synchronous, half-duplex, serial communication bus that is commonly used for issuing instructions and establishing handshakes. It can also be used to transfer data, but it is typically used for slow output data devices such as sensors.

Main Features

BUS Pins

Protocol Basics

I2C communication is based on a simple protocol that consists of four types of messages:

7-bit slave addressing

I2C devices are addressed using a 7-bit address. This allows for 128 (2^7) unique slave addresses. However, in practice, it is not practical to have all 128 addresses on one bus due to limited bus bandwidth.

8-bit packet frame

Each I2C message consists of an 8-bit packet frame. The packet frame is structured as follows:

Arbitration

If two master devices attempt to access the bus at the same time, a process called arbitration is used to determine which device will have control of the bus. Arbitration is based on the principle of "first come, first served."

Slave clock stretching

If a slave device needs more time to process the current data before the next data frame is transferred, it can stretch the clock. Clock stretching is done by the slave device holding the clock line low until it is ready to continue.

Helpful Software Debug Tools

There are a number of software tools that can be used to debug I2C communication. One popular tool is the i2c-tools package, which is available for Linux. This package provides a number of commands that can be used to read and write data on the I2C bus, as well as to query the status of the bus.

Debug Hardware Tools

A I2C logic analyzer can be used to sniff, read, and write on I2C bus. Two popular logic analyzers are the Salae logic analyzer and the Aardvark I2C/SPI Host Adapter. These logic analyzers come with their own analysis software that can be used to view and analyze I2C traffic.

SPI

Main Purpose

SPI (Serial Peripheral Interface) is a synchronous, full-duplex, serial communication bus that is commonly used for transferring data. It is typically used for high-speed data transfer applications, such as connecting memory chips and flash drives.

Main Features

BUS Pins

Debug Hardware Tool

A SPI logic analyzer can be used to sniff, read, and write on the SPI bus. Two popular logic analyzers are the Salae logic analyzer and the Aardvark I2C/SPI Host Adapter. These logic analyzers come with their own analysis software that can be used to view and analyze SPI traffic.

UART

Main Purpose

UART (Universal Asynchronous Receiver/Transmitter) is a simple, asynchronous, serial communication protocol that is commonly used for sending control commands and loading small firmware to devices. It is typically used for debugging purposes, such as connecting a PC to a microcontroller to send commands and view the output.

Main Features

BUS Pins

Helpful Serial Terminal Application

Debug External Hardware Interface

Q&A

Q What affects the length of interconnects?

Q How do I adjust drive strength to improve signal integrity?


Summary

Conclusion

Slow digital interfaces are essential for all subsystems to initialize, handshake, and provide essential data for the entire system to work with each other.