In MCU, both I2C and SPI are important protocols. What’s the differences between them?
I2C can be
multi-master and multi-slave, which means there can be more than one master and
slave attached to the I2C bus. SPI can be multi-save but does not a
multi-master serial protocol, that means there can be only one master attached
to SPI bus.
I2C is half-duplex
communication protocol. SPI is a full duplex commination protocol.
I2C and SPI have their own strengths. I2C is more complex to set-up, once stable you can so easily extend. SPI is easy to set-up, you can bit bang it very easily if required.
Compared with I2C, SPI is faster. SPI needs three or four wire for communication (depends on requirement), MOSI, MISO, SCL and Chip-select pin. I2C is used only two wire for the communication, one wire is used for the data and the second wire is used for the clock.