Who starts the talk
On an I2C bus one chip starts every conversation and runs the clock, and every other chip only ever answers. A module with news cannot say so; it waits to be asked.
Every chip on an I2C bus has one of two jobs. The controller starts conversations and sends the clock; on these pages it is the ESP32. Every module is a target: it listens, and answers when it is spoken to. Older books, most datasheets and the Arduino examples call them master and slave, the names the specification used until 2021.
The rule is strict. A target never starts. It cannot send a byte, or even a clock tick, until the controller has addressed it. So a conversation always has the same shape: the ESP32 sends, and the target replies on the same data wire. SDA carries data both ways. SCL only ever comes from the controller.
A module with news has to wait
A keypad that has just been pressed has something to say, and no way to say it. The ESP32 finds out only when it next asks, which is why a program that reads a keypad over I2C asks again and again, many times a second. That is called polling.
Some modules add a fifth pin, INT, that the module pulls when it has news. Wire it to a GPIO and the ESP32 can stop asking all the time and ask only when INT says so. The asking itself still starts at the ESP32.
In an Arduino sketch, the question is one line. This asks the module at address 0x48 for two bytes, and the ESP32 sends the clock for all of them:
Wire.requestFrom(0x48, 2);More than one controller
The rules allow two controllers on one bus. If both start at once, each watches SDA on every bit, and the first to send a one while the line reads zero knows it has lost and stops, without damaging the other's message. Almost nothing a beginner builds needs it, and this course keeps to one.
Edit this page — content/fundamentals/i2c/who-starts-the-talk.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.