I am studying I2C protocol and have some doubts:

  1. I2C and SPI are communication protocols. They work same but I2C has not chip select as SPI. I2C has start and stop conditions. Are there other difference?

  2. how does I2C slave receive bits? Bit every clk?

  3. If yes (q.2), can I use the same process implemented in VHDL for receiving bits?

  • 6
    \$\begingroup\$ I2C and SPI are very different. There are way more differences than similarities, so listing them here is pointless. I suggest you to read the specs of both instead. \$\endgroup\$ – Eugene Sh. Jun 3 at 14:21
  • 1
    \$\begingroup\$ Too broad. 30 mins of read of two Wikipedia articles would have cleared your questions up. \$\endgroup\$ – Mitu Raj Jun 3 at 14:39

SPI and I2C aren't really the same at all, except at a trivial level in that they're both serial and use a separate clock to transfer one bit per clock (and that's not even truly the case with SPI, which can be wider than 1 bit: 2, 4 and 8-bit wide versions are available.)

Beyond this, how are I2C and SPI different? As a protocol, I2C requires more processing and state-machine control to deal with receiving bits and determining packet state than SPI, which in contrast is a much more rudimentary serial-in serial-out protocol, with transfers framed by chip select.

On the other hand, SPI supports a wider variety of modes: data width, speed, clocking polarity/phase, single/double data rate, compared to I2C which only supports different speeds. Finally, SPI is much faster than I2C: the very fastest SPI clock rate is well north of 100 MHz, while the fastest I2C variant is 3MHz.

If your goal is to design a dual-mode controller in VHDL, it will be much easier to create separate I2C and SPI controllers and share the pins using a mode select. Further, a SPI implementation will likely need high-priority system I/O (like FIFO and DMA) to deal with its increased throughput.

I've seen systems that share physical SPI and I2C signals (for example, sharing an I2C EEPROM with a SPI DAC or ADC.) This is possible since chip select negated will make SPI ignore I2C, and it's also possible to carefully code SPI so that it never emits a START or STOP condition (that is, never change SDA state while SCL is high) so I2C endpoints will also ignore SPI. But the endpoints themselves will be working in one mode or another, not dynamically switching between I2C or SPI.

  • \$\begingroup\$ Can I2C work without SPI? \$\endgroup\$ – LeeLeeYa Jun 4 at 7:06
  • \$\begingroup\$ Not sure what you're getting at. As I said, if your goal is to make a controller that supports both, design the blocks separately then use mode selection to connect them to the pins. You would do that as part of your near-pad logic. \$\endgroup\$ – hacktastical Jun 4 at 19:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.