I²C vs SPI
Compare I²C and SPI. When would you choose each?
| Level | ● screening |
| Track | Embedded & wearables |
| Really testing | Topology, speed, and the hidden analog design of I²C. |
Free full answer — one of 12 questions answered in full on this site.
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.
Try it
I²C pull-up window — free tool →
Going deeper
Worked example — throughput. Reading 6 bytes from a sensor register:
- I²C at 400 kHz: about 9 bytes on the wire (address, register, restart, address, 6 data) × 9 bits ≈ 85 bit times → about 0.2 ms.
- SPI at 10 MHz: 1 command byte + 6 data bytes = 56 bits → about 6 µs.
Practical issues to raise
- Two identical I²C sensors with a fixed address → an I²C mux or two buses.
- Level shifting: I²C needs bidirectional open-drain shifters; SPI uses simple one-way buffers.
- SPI mode: CPOL/CPHA must match — a mismatch often "almost works" and shifts every byte by a bit.
- Clock stretching: some masters don't support it, and some slaves rely on it.
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.
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.