Wednesday, September 3, 2014

SPI vs I2C:

1. I2C is quite involved, supporting multiple masters on the bus. Which causes significant overhead in the bus protocol, an ACK for every byte and intentional delays to arbitrate access to the bus. Also a set maximum bus rate, 100 kHz in the original spec, 400 kHz is common today, additional 10 kHz low-speed and 3.4 Mhz high-speed modes, the 2012 spec defines a 5 Mhz ultra-fast mode.
    SPI is much simpler, a single master with no bus protocol beyond a chip select and no set maximum bus rate. If the distances are short then you can go as fast as you dare. Quite fast on an interconnect between chips that are less than an inch apart.

2. I2C: all lines are open-collector which means that the transmitter only drives the line low. When the transmitter releases the line, a resistor connected to Vcc (supply voltage) pulls the light high. However, due to capacitance of the wire and the components, the wire goes to high voltage relatively slowly. Because of this, the clock speed must be reduced to allow time for the lines to "drift" high.
    SPI: all lines are driven by the transmitter both high and low. This minimizes the time required for the wire to change states.

3. SPI is full deplex and I2C is half duplex.

4. I2C require less pin then SPI (SPI 3wire: 3 IOs, SPI 4 wire: 4 IOs, I2C: 2 IOs) as SPI require slave select for individual device.
Note: To save pins used when having multiple slaves in the system, Daisy-Chaining concept is used. read more here.

5.  SPI is faster than I2C.

No comments:

Post a Comment