Abstract communications image

All but the simplest of electronic products are likely to use multiple Integrated Circuits (also known as ICs or simply ‘chips’) in their design. These devices and peripherals need to communicate with each other to be able to operate. For example, a main microprocessor may need to send commands to a display screen, read inputs from digital sensors and transfer data to and from external memory or a secondary processor.
Two common protocols for short distance (usually on-board Printed Circuit Board (PCB)) communications in embedded systems are SPI and I2C. These are both serial protocols, meaning the data is transferred one bit at a time along a single wire.

The Serial Peripheral Interface (SPI), as the name suggests, is a commonly used interface for many peripheral ICs and can be found in devices as diverse as battery monitor ICs, real time clocks (RTCs), Analogue-to-Digital Converters and Digital-to-Analogue Converters (ADCs and DACs), I/O expanders, motor controllers, memory (such as EEPROM, FLASH, non-volatile RAM, SRAM, and SD cards), display drivers and touch screen controllers. SPI is also often used as the interface to wireless modules such as Bluetooth, Ethernet, GPS, GSM, WLAN and ZigBee, which provide a straightforward way to design external comms interfaces into an embedded system product.


SPI is a synchronous (i.e. clocked) full duplex (i.e. can send and receive data at the same time) protocol which uses a master-slave architecture and has good signal integrity due to its push-pull drivers rather than using open-drains. It typically requires four lines (PCB tracks) between the peripheral and the processor, commonly known as SDI or MISO (Serial Data In, or Master In Slave Out), SDO or MOSI (Serial Data Out or Master Out Slave In), and SCLK (serial clock, also abbreviated as SCK or CLK). The main microcontroller is the master and controls the clock signal; multiple slave peripherals can be connected to an SPI bus, with each one additionally requiring its own dedicated ‘chip select’ (or ‘slave select’) line to enable / disable the comms to that device as appropriate. If a single slave device is used it may be possible to just use three lines between the master and slave, and to fix / tie the peripheral’s Chip Select line to the enabled position, provided the slave does not require an edge transition on this line to trigger a data transfer.

Many microcontrollers incorporate one or more SPI hardware peripherals, enabling fast and efficient data transfers between devices with little software control / processor overhead. Alternatively in very simple product designs where cost and space are at a premium and a small processor with minimal peripherals is most appropriate, if the processor is not burdened with other complex software tasks an SPI interface can be ‘bit bashed’ (or ‘bit banged’) in software by manually setting / reading GPIO (general purpose input / output) pins for the SDI and SDO lines and toggling the clock line up and down to transfer one bit of data at a time.

SPI interfaces can typically transfer data at speeds of around 10 or 20 MHz.


The Inter-Integrated-Circuit (I2C, usually pronounced ‘I squared C’) protocol, as the name suggests, is typically used for communications between chips on a single PCB inside an electronic product. Unlike SPI it uses the concept of addresses (it can connect up to 127 nodes) rather than Chip Select lines and is half-duplex (i.e. can only send data one way at a time). I2C requires only two data lines, known as SDA (data) and SCL (clock) (in addition to common power and ground connections) and is therefore also sometimes referred to as TWI (Two Wire Interface). The two wire comms bus uses up less board real estate and simplifies the routing of PCB tracks, thus allowing the overall product design to be more compact; multiple slave devices simply hook up to the two communal data bus lines.

When the master (usually the microcontroller) wishes to communicate with a peripheral device it sends the address of the slave it wishes to talk to by pulsing the SDA line with data and toggling the SCL clock line in sync with it. Some slaves have addresses which are fixed by the manufacturer while others are configurable. Only one device (i.e. either the master initiating a data transfer or a single slave responding to it) can control the bus at any one time, and all other devices on the bus are designed to stay silent during this period.

As with SPI, I2C is commonly used to communicate with many essential components used in embedded system designs such as wireless modules, sensors, memory, display drivers, HDMI interfaces, digital signal controllers and digital signal processors (DSCs and DSPs), digital potentiometers and battery fuel gauge ICs. Many microcontrollers incorporate dedicated I2C hardware peripherals in their design which frees up the software / processor to perform high-level functions and allows data transfer to take place efficiently under hardware control.

The original standard I2C interface can support data transfer at up to 100 KHz; later updates have introduced a fast transfer speed of up to 400 kHz and even a high speed of over 1 MHz, although this is still much slower than SPI transfers.


I2S (also known as Inter-Integrated-Chip Sound) was specifically developed for serial data transfer between digital audio devices on a single PCB. Some microcontrollers have dedicated I2S hardware ports that enable them to use this protocol to interface with suitable audio CODECs and ADC / DACs.