HW Interview
EM-01 · Chapter 8 · Low-Speed Interfaces & Embedded Hardware

I²C vs SPI

Compare I²C and SPI. When would you choose each?

Level● screening
TrackEmbedded & wearables
Really testingTopology, speed, and the hidden analog design of I²C.

Free full answer — one of 12 questions answered in full on this site.

Think first. Before you read on: compare the number of wires, who drives each line (open-drain or push-pull), and how one device is selected on each bus.
Show the answer

Say this first: I²C: 2 wires, open-drain with pull-ups, half-duplex, addressed devices on a shared bus, 100 k/400 k/1 MHz (3.4 MHz HS). SPI: 4 wires (SCLK, MOSI, MISO, CS per device), push-pull, full-duplex, no addressing, tens of MHz. Choose I²C for many slow devices with few pins (sensors, PMICs, EEPROMs); SPI for throughput (flash, displays, ADCs).

Then explain: I²C is "analog-ish": pull-up sizing vs bus capacitance and rise time (see EM-02), address conflicts, clock stretching, a stuck bus needing 9-clock recovery. SPI needs a CS per device and has no acknowledge, but it's simple for firmware and easy to scope.

Common mistake. Treating I²C as purely digital. Its speed limit is set by the pull-up resistors and the bus capacitance — an RC circuit with a timing spec.

Try it

I²C pull-up window — free tool →

Going deeper

Worked example — throughput. Reading 6 bytes from a sensor register:

Practical issues to raise

Where people go wrong: treating I²C as purely digital — it is an RC circuit with a timing spec (see EM-02).

More like this in the book

This is EM-01 from Hardware Engineer Interview Questions. The book has 12 questions on low-speed interfaces & embedded hardware and 141 in all, each answered the same way: what to say first, how to explain it, the numbers worth quoting and the follow-ups that come next.

About the bookRead a free sample (PDF)

Errata

No corrections known for this question. All errata

Ask about this question

Stuck on a step, or think something is wrong? Send it with EM-01 in the subject. Good questions get answered on this page, and corrections go into the next printing.

Ask about EM-01

Related

EM-02 Sizing I²C pull-ups →