Syllabus

  • I2C and SPI Protocol

I2C Protocol

Introduction

I2C_Configuration.png

I2C is a two-wire synchronous serial communication protocol. SDA line is used for transferring data and SCK is used for transferring clock information. Every device connected to an I2C bus has a unique address. I2C communication protocol involves communication between a slave and a master. The device which initiates the communication and which provides the clock is referred to as a master device. The devices which receive the clock signal and receive/transmit data according to the clock signal is termed as a slave device. Each device on the bus is accessed using its slave address.

Communication process in an I2C bus

START condition

First the MCU will issue a START condition. The devices connected to the bus will listen to the START condition and will stay ready to begin the communication process.

Then MCU will send the address of the device with which it needs to communicate. Master indicates the action to be performed with the device whether to read or write along with the address.

All devices connected to the bus will receive the address and will compare it with its own address. If the addresses match with each other, the device will send back an ACKNOWLEDGEMENT signal to the master device. If they don’t match they will simply wait for the bus to be released with a STOP condition.

Once the MCU sends the address and corresponding device acknowledges, the MCU can start transmitting or receiving data.

When the data transmission or reception is complete, the MCU will stop communicating by sending a STOP condition.

STOP condition

STOP condition indicates that the bus is released and it can be used by any other master (if any) connected to the I2C bus.

After a master generate a start condition I2C bus will solely belong to it. The bus will be freed only if the master generate a STOP condition. Any other master connected to the bus can access the bus after a STOP is identified on the bus.

If the master device which uses the bus needs to communicate with a different slave it should generate a RESTART. Instead if it tries to stop current communication and then start again it may lose access to the bus. RESTART is nothing but a start signal without a stop in the bus.

SPI Protocol

SPI.png

gjhfdjhiufgufdvbjgfjb

spi_waveform.png

Comparison of I2C and SPI Protocol

I2CSPI

I2C_Configuration.png

SPI.png

Requires only two lines SDA,SCLRequires minimum four lines,SS,SDA(MOSI), SDI(MISO), SCL
Low SpeedHigher Speed
Half DuplexFull Duplex 
Additional Signal select lines not required if devices increasesAdditional Signal select lines are required as devices increases
 
More Power requiredLess Power Required 
Multimastercan be used easilyMultimasteris difficult to implement
  

References

  • Created and Developed by Prof.Sujit Wagh, SKNCOE, Pune
  • WikiNote Foundation
Tags:
Created by Sujit Wagh on 2017/10/03 18:41