Maker Pro
Maker Pro

Which is better I2C or SPI

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
I have seen that many sensors work on both I2C and SPI protocols. Which protocol do you use in this case?
 

PETERDECO

Dec 19, 2019
239
Joined
Dec 19, 2019
Messages
239
I personally use SPI but have seen datasheets for devices using I2C stating less connections are needed.
 

MicroMe

May 18, 2014
21
Joined
May 18, 2014
Messages
21
I use both depending what I have available but prefer SPI especially if a driver is available.
The best brief summary I have seen is "A few years after Philips released I2C, Motorola introduced the SPI bus. It was much simpler both in hardware and software and a whole lot faster. The end user often has to create custom drivers for a particular application and it’s less robust. But it is fast." from https://www.rs-online.com/designspark/catching-a-bus-basic-serial-communication-part-4-i2c obviously someones opinion, but I tend to agree....
 

Nanren888

Nov 8, 2015
621
Joined
Nov 8, 2015
Messages
621
Another point to note is that when it comes to interfacing there is not just one thing in one configuration called SPI. Different devices will otften have variants. Many modules are designed with mutliple options or registers to allow them to interface flexibly, which increass versatility, but also the need for configuration.
.
Generally ease comes with things known to be compatible and a driver being available. Not unknown though to have to modify the driver a little to get a particular module/device to work.

https://www.arrow.com/en/research-and-events/articles/spi-vs-i2c-protocols-pros-and-cons#:~:text=SPI and I2C were both,the 3.3 or 5V range.
appears to say
I2C simplicity
SPI: full-duplex, speed,
 
Top