Protocol Essentials
Just enough protocol to design hardware well: how transfers start and stop, how addressing works, what ACK really is electrically, and why clock stretching can make or break your design.
START, STOP and repeated START
AnimatedData on SDA is only allowed to change while SCL is low. The two deliberate violations of that rule are the framing signals:
- START (S): SDA falls while SCL is high — "everyone listen".
- STOP (P): SDA rises while SCL is high — "bus is free".
- Repeated START (Sr): a second START without an intervening STOP — keeps the bus ownership between two transfers (essential for register reads and multi-master safety).
START: SDA falls while SCL is high. STOP: SDA rises while SCL is high. In between, SDA may only change while SCL is low.
Addressing: 7-bit (and 10-bit)
Every transfer begins with the controller broadcasting an address byte: 7 address bits plus a R/W̄ bit (1 = read, 0 = write). The one target that recognizes the address ACKs; everyone else ignores the rest of the transfer.
| Address range | Reserved for |
|---|---|
| 0000 000 | General call (0x00) / START byte |
| 0000 001 – 0000 111 | CBUS, reserved, Hs-mode controller code |
| 1111 0XX | 10-bit addressing prefix |
| 1111 1XX | Device ID / reserved |
| 0x08 – 0x77 | Usable 7-bit device addresses (112) |
10-bit addressing exists (prefix 11110XX + second address byte) but is rare in practice; support it only when a specific part needs it.
ACK / NACK — a hardware signal, not a courtesy
After every 8 bits, the transmitter releases SDA for one clock. If the receiver pulls SDA low, that's ACK; if SDA stays high (pull-up wins), that's NACK. Electrically, an ACK proves a real device sits at that address and that your pull-up, VOL and timing are all within spec — which is why a scope shot of the ACK bit is the single most useful I2C bring-up measurement (Module 07).
- NACK on address: nobody home — wrong address, wrong bus, or device unpowered.
- NACK on data (write): target can't accept more (buffer full, busy).
- NACK by controller (read): deliberate — "last byte, I'm done".
Clock stretching
A slow target can hold SCL low after an ACK until it's ready — the controller must detect that SCL hasn't actually risen and wait. That's only possible because SCL is open-drain too.
The three transactions you'll actually use
1. Plain write — set a register, send a command:
2. Plain read — read from the target's current position:
3. Register read (write-then-read) — the pattern 95 % of sensor traffic uses. Note the repeated START: the bus is never released between pointing at the register and reading it.
Key takeaways
- START/STOP are SDA transitions while SCL is high; everything else changes only while SCL is low.
- 112 usable 7-bit addresses; watch out for "8-bit address" datasheets.
- ACK is electrical proof your bus works; the ACK bit is your best scope target.
- Support clock stretching in the controller, and set a firmware timeout for it.