Search topics...
I2CBus Arbitrationfoundational

Explain I2C bus arbitration step by step. What happens when two masters transmit simultaneously?

0 upvotes
Practice with AISoon
Study the fundamentals first — I2C topic page

I2C bus arbitration is a non-destructive process that occurs bit-by-bit on the SDA line. It relies on the open-drain/wire-AND property of the bus: if any device pulls SDA low, it reads low regardless of what other devices are doing.

Step-by-step: (1) Both masters detect that the bus is idle (SDA and SCL both high) and assert START at approximately the same time. (2) Both begin transmitting the first byte (slave address + R/W bit), driving SDA on the falling edge of SCL and reading it on the rising edge. (3) For each bit, each master compares what it sent against what it reads on the bus. As long as both masters are sending the same bit value, both see the expected value and continue. (4) The first bit where they differ decides the winner: the master sending a 0 (dominant) sees a 0 on the bus — as expected — and continues transmitting. The master sending a 1 (recessive) also sees a 0 on the bus (because the other master is pulling it low), realizes it has lost arbitration, and immediately stops driving SDA. It switches to listening mode and waits for the bus to become free.

Example: Master A sends address 0x48 (0b1001000 + W = 0b10010000), Master B sends 0x44 (0b1000100 + W = 0b10001000). Bits 7-5 are identical (100). At bit 4, Master A sends 1 (recessive), Master B sends 0 (dominant). Master A reads 0, realizes it lost, and backs off. Master B's transaction continues without corruption.

The arbitration process is completely transparent to the winning master — it never knows arbitration occurred. The losing master retries its transaction after the bus becomes free (after the winning master's STOP). No data is lost or corrupted. This is possible only because the open-drain bus physics guarantee that a dominant bit always overrides a recessive bit.

Source: I2C Q&A