I have seen I2C and SPI interfaces being used with EEPROMs and other ICs.

From an Hardware Perspective, what interface should be selected when ?

One obvious reason I can find is that, I2C uses only 2 pins whereas SPI uses 4 pins. So, if we are short on IO pins, we can go for I2C or else SPI.

And I find that SPI has daisy chaining. So, any advantage with this?

And since I2C uses only 2 pins, what could the hardware issue that could possibly go wrong with the I2C interface?

Can someone please tell me which interface to use when? And what could be the hardware issue if we use I2C ?

  • SPI can be faster as it is push-pulled lines, in the contrary to I2C that uses pullup resistors.

  • SPI can be daisy-chained, but usually it requires the slave device to be of the same type.

  • SPI will need a CS line for each device, while I2C works by addressing.

  • The SPI software stack is usually simpler than I2C.

  • I2C allows to have many devices on the same line, but often if you need several of the same devices, they will have the same address and thus it becomes a problem. Some devices can come with different address (different part number) but that increases the BOM and cost.

  • Given I2C is driven by pull-down, you can have devices with different voltages (FI 5V and 3V3), the bus voltage is set by the pull-up resistors that can be of the lower voltage chip.

Can someone please tell me which interface to use when? And what could be the hardware issue if we use I2C ?

If you hesitate, go with SPI, it's (usually) easier to interface on a stack level, doesn't need external resistor, you don't need to care about addressing and it's faster.

More details here

  • \$\begingroup\$ Thank you for the answer. \$\endgroup\$ – Newbie Jun 17 at 5:25
  • \$\begingroup\$ Just one doubt. But could you tip me with the logic on why push pull lines are faster on the contrary to the I2C which uses external pull-up ? \$\endgroup\$ – Newbie Jun 17 at 5:27
  • 2
    \$\begingroup\$ Because of the traces / devices capacitive effects and line inductance, I2C usually have 1k - 10kohm pull-up resistor, beyond certain speed, the resistor won't have time to pullup, while SPI lines are driven high-low directly by the chip, resulting in faster edges. \$\endgroup\$ – Damien Jun 17 at 5:30
  • 2
    \$\begingroup\$ SPI does not define any speed limit; implementations often go over 10 Mbps. I²C is limited to 1Mbps in Fast Mode+ and to 3.4 Mbps in High Speed Mode @Newbie \$\endgroup\$ – Damien Jun 17 at 5:34

SPI for bandwidth and full-duplex. Daisy chaining for SPI just makes it easier to grab data from a lot of SPI devices, but only for devices that support it and only for identical devices since their daisy chaining is only made to work with others of their kind.

I2C for addressing (you can handle more devices without a chip select line for every device and without the daisy-chain limitations of SPI listed above), low wires count, and muli-master capability.

Can someone please tell me which interface to use when? And what could be the hardware issue if we use I2C ?

Very simple. You just use the interface your IC comes with. You often don't have a choice.

  • \$\begingroup\$ Thank you for the answer. Could you also give me some glimpse of the hardware issues that might arise while using I2C and SPI interface? \$\endgroup\$ – Newbie Jun 17 at 5:20
  • \$\begingroup\$ That question is so vague I don't even know what it is you want to know. \$\endgroup\$ – DKNguyen Jun 17 at 5:21
  • \$\begingroup\$ I am asking like, what would be the hardware issues that one might come across while using the interfaces. I am also trying to understand or may be in future take a decision of which interface to use (if there's a choice for me) \$\endgroup\$ – Newbie Jun 17 at 5:22
  • \$\begingroup\$ That doesn't say anything new. Best for you just to read up on how each interface works. \$\endgroup\$ – DKNguyen Jun 17 at 5:22
  • 1
    \$\begingroup\$ I understand what you're asking now but that's still super broad and unfocused. There's not that much point knowing the infinite number of things that could go wrong when it would be a lot more productive just to learn how the interface works to learn the limited number of things you need to do for it to be correct. \$\endgroup\$ – DKNguyen Jun 17 at 5:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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