Author Topic: When Exactly Does I2C Arbitration Occur?  (Read 840 times)

0 Members and 1 Guest are viewing this topic.

Offline EVblog1Topic starter

  • Regular Contributor
  • *
  • Posts: 126
  • Country: 00
When Exactly Does I2C Arbitration Occur?
« 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.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4805
  • Country: us
Re: When Exactly Does I2C Arbitration Occur?
« Reply #1 on: June 11, 2026, 01:54:16 pm »
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. 
 
The following users thanked this post: EVblog1

Offline EVblog1Topic starter

  • Regular Contributor
  • *
  • Posts: 126
  • Country: 00
Re: When Exactly Does I2C Arbitration Occur?
« Reply #2 on: June 12, 2026, 01:31:09 pm »
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 ?
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4805
  • Country: us
Re: When Exactly Does I2C Arbitration Occur?
« Reply #3 on: June 12, 2026, 03:46:01 pm »
Two slaves with the same address is invalid so there is no arbitration.  Just likely data corruption.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf