- I want to know out of SPI and I2C communication protocol which one is Faster? I have read in an article that SPI is faster but they have not given an explanation why? Is it because of less overhead in SPI when compared to I2C (like start, ack, stop)?
- Which one is better out of two? I have seen that for ADC mostly SPI is preferred, but why? For Flash also I have mostly seen SPI protocol being used, but for Sensor both SPI and I2C. Now, what makes as to decide that for one peripheral I should go with SPI and for another I2C is preferred?
Asked
Active
Viewed 2,783 times
-3

Krystian Sakowski
- 1,613
- 14
- 20

priya91
- 25
- 1
- 3
-
1A other bad thing about I2C, it use open-collectors with only 3mA, while SPI use a full push-pull, this make SPI less error prone. – 12431234123412341234123 Apr 15 '17 at 06:13
-
1You might have saved this question by asking "What are the differences..." rather the which is better. Bit the question would still them be more appropriate on You appear to be lost; this is the wrong site for this question; try http://electronics.stackexchange.com/ – Clifford Apr 15 '17 at 08:37
-
You use I2C when the peripheral has I2C and SPI when it has spi. If it is not performance critical (say an lcd display) then it might support either on the same chip. or have a version with one and a version with the other. For things that need performance they will have spi. – old_timer Apr 16 '17 at 03:13
-
spi you can share some of the signals although you will find that some peripherals do not play nice with others. and you are limited on the number of chip selects beyond that. With i2c you can have a lot more peripherals on the same bus. – old_timer Apr 16 '17 at 03:14
1 Answers
3
Better question is when I should use I2C and when I should use SPI. Like always in engineering there are different pros and cons in both protocols. I compared them below so you will be able to asses what is better match for your requirements.
Quick comparison of my own:
Additional remarks:
- SPI is usually used for slave devices where speed matters e.g. ADC peripherals, FLASH memories etc.
- I2C is usually used for slave devices which are fine with I2C speed constrains or which are kind of slow like sensors which can take longer time to get the measure e.g. popular temperature and humidity sensor HTU21-D with I2C performs measure between 3-16 [ms] (this time depends on the selected measurement resolution).
- Post explaining I2C Bus Length constrains.
- Post explaining why SPI is faster than I2C
PS:
- The fastest ADC peripherals are not using either I2C or SPI. They use parallel I/O.
- Keep in mind that for simple (hobby) projects it usually doesn’t matter and you will be fine with either of them.

Community
- 1
- 1

Krystian Sakowski
- 1,613
- 14
- 20
-
I2C over 1m is also very bad (Error prone, or you need extra work to prevent it) , i would not use I2C for more than about 20cm. – 12431234123412341234123 Apr 15 '17 at 06:11
-
1Good point. Checksum or at least parity bit is always useful, even more for longer distances. – Krystian Sakowski Apr 15 '17 at 06:16
-
@KrystianSakowski : I once worked on a project that used SPI over distance and had errors which were assumed to be interference from heavy electrical loads in the system, the team added layers of error checking and retry protocol and it was still unreliable. In the end all the errors were being introduced by the software; once the fundamental bug in the SPI driver was fixed, the error checking/retry stuff became redundant. So my point is; test it over a short distance in an electrically benign environment before adding code to cope with signal integrity and interference issues. – Clifford Apr 15 '17 at 08:46
-
You can "daisy-chain" SPI nodes, making them somewhat more scalable. But this comes at the cost of shifting around all data through all nodes, so in practice you cut the speed down each time you add a new node. – Lundin Apr 20 '17 at 11:28