Skip to main content

Subsection 10.4.2 The Protocol: Addressing, and the ACK

Because every device hears every bit, the protocol needs a way to reach one device without disturbing the rest. Every I2C device has a 7-bit address, fixed by its manufacturer and printed in its datasheet, sometimes with two or three of its low bits selectable on the board, which is how eight identical parts can share one bus. At the start of every transaction the controller broadcasts that address plus a single read/write bit (eight bits, clocked out one at a time on SDA) and every device on the bus compares the address it hears against its own.
The device whose address matches answers by pulling SDA LOW during the ninth clock pulse. That one-bit reply is the ACK, for acknowledge. From the controller’s side: SDA LOW after the address byte means a device recognized the address and the transaction can go on. SDA staying HIGH is a NACK, nobody claimed that address, which usually means the address is wrong, the device is unpowered, or a wire is off.
Data bytes follow the same way, each one acknowledged by whichever side is receiving: the device for a write, the controller for a read. A NACK on a data byte tells the sender the receiver could not take it.
One device is in charge of all of this. The controller, our STM32C031C6, generates the clock, starts every transaction and decides who is being addressed. Everything else on the bus is a target, and a target only ever speaks when spoken to. (Older documents, including the reference manual’s own I2C chapter, use “master” and “slave” for these two roles. The hardware is the same; the words have changed.)