SPI vs I2C | Difference between SPI and I2C interface types

This page compares SPI vs I2C interfaces and mentions difference between SPI and I2C. SPI stands for Serial Peripheral Interface and I2C stands for Inter-Integrated Circuit.

SPI Interface

SPI interface

Following are the features of SPI Interface:
• SPI stands for Serial Peripheral Interface.
• It is full duplex and 3 wire synchronous protocol.
• It operates in master and slave modes. 1.5 MHz is used as master bit frequency and 3 MHz is used as slave bit frequency.
•  • The CLK here is set to different rates unlike RS232 interface. Total four progammable master bit rates can be used. The clock polarity and phase is programmable.
• It is ideal for micro-controllers which have imprecise clock signal.
• Here master controls the clock and slaves are controlled by the master clock. Slaves can not manipulate the clock. If there is no clock then there would not be any data transfer.
• Data is only output during rising or falling edge of the CLK. Data is latched during opposite edge of the CLK.

• Figure-1 depicts SPI interface between 1 master and 3 slaves. There are total four signals used in SPI communication. AS shown all the devices are connected with SCLK (clock) signal. MOSI and MISO refers to Master Out Slave In and Master IN Slave Out respectively. Hence SPI is bi-directional interface. All the slave devices are managed by master using separate Slave Select signals(SS1', SS2', SS3') as shown.

There are three registers used in SPI interface viz. SPCR, SPSR and SPDR. SPCR is used for control, SPSR is used for status and SPDR is used for data storage functions.
SPCR-Serial Peripheral Control Register
SPSR-Serial Peripheral Status Register
SPDR-Serial Peripheral Data Register

I2C Interface

I2C interface

Following are the features of I2C interface protocol:
• I2C is the short form of Inter-Integrated Circuit Serial Protocol.
• It is also referred as IIC or I2C or I2C.
• It is a two wire interface one carries data (SDA) and other carries clock (SCL) .
• It allows upto 27 devices to be connected.
• Each device has its own unique address for identification.
• It supports data rate upto 400 KHz.
• The interface is shown in the figure-2, as shown it consists of 1 master and rest of the devices operate in slave mode. Pull up resistor usually range between 1.53 KOhm to 100 KOhm.

I2C Protocol consists of following fields:
• Start condition-It is signaled by falling edge of SDA line while SCL line is kept high. It is initiated by a master. Clock is controlled by master.
• Address packet consisting of read/write indication and slave acknowledge (SLA). SLA is set by the slave device.
• One or more data packets, 8 data bits and MSB is first.
• Stop condition

What is difference between or comparison between

Following links mention difference or comparison between various equipments and terms:
comparison between SPI and I2C
difference between PXI and PCI
Microscope vs Telescope
Amplitude Modulation vs Angle Modulation
difference between modem and router
Air Fuel Ratio Sensor vs O2 Sensor
Radiometer vs Spectrometer vs Spectroradiometer
Clamp meter vs digital multimeter
Colorimeter vs Spectrophotometer
difference between Prism and Grating
difference between Venturi meter and Orifice meter
difference between Lux and Lumens