EEVblog® Electronics Community Forum
Electronics => Microcontrollers => Topic started by: EVblog1 on June 11, 2026, 01:45:09 pm
-
I am a bit confused about how arbitration happens in I2C communication.
What I understand is that if we have two MCUs (AVR and PIC) and one DS1307, and the AVR has already started communicating with the DS1307, then the PIC cannot start communication because the bus is busy. The PIC must wait until the bus becomes idle.
My question is: what happens if both the PIC and AVR want to start communication at exactly the same time?
Does arbitration happen as soon as they generate the START condition, or can both masters generate the START condition and then arbitration occurs while they are sending the slave address?
I would appreciate it if someone could explain the exact sequence.
-
It happens rhe first time one master detects the bus low when kt expects it to be high. If they start at exactly the same time, that could be durinng the address transmission.
i think technically if two masters send the same command to the same slave at the same time they could completely overlap and the collision would be undetected.
-
So if both the PIC and AVR generate the START condition at exactly the same time, no collision is detected. Arbitration happens when the transmitted bits differ.
For example, if the PIC sends a '1' and the AVR sends a '0' at the same time, the PIC loses arbitration and the AVR wins. The first different bit determines the winner.
One more question. Suppose we have one master (PIC) and two DS1307 devices connected on the same I2C bus. If the PIC generates a START condition and sends the slave address, and both DS1307 devices have the same address, what happens? Will both devices respond with ACK and drive the bus at the same time? How communication will happens ?
-
Two slaves with the same address is invalid so there is no arbitration. Just likely data corruption.