Here are some of the features of the I2C-bus:
...
• It’s a true multi-master bus including collision detection
and arbitration to prevent data corruption if two or more
masters simultaneously initiate data transfer
...
The I2C-bus is a multi-master bus. This means that more
than one device capable of controlling the bus can be
connected to it. As masters are usually micro-controllers,
let’s consider the case of a data transfer between two
microcontrollers connected to the I2C-bus (see Fig.2).
This highlights the master-slave and receiver-transmitter
relationships to be found on the I2C-bus. It should be noted
that these relationships are not permanent, but only
depend on the direction of data transfer at that time. The
transfer of data would proceed as follows:
1) Suppose microcontroller A wants to send information to microcontroller B:
• microcontroller A (master), addresses microcontroller B (slave)
• microcontroller A (master-transmitter), sends data to microcontroller B (slave- receiver)
• microcontroller A terminates the transfer
2) If microcontroller A wants to receive information from microcontroller B:
• microcontroller A (master) addresses microcontroller B (slave)
• microcontroller A (master- receiver) receives data from microcontroller B (slave- transmitter)
• microcontroller A terminates the transfer.
Even in this case, the master (microcontroller A) generates
the timing and terminates the transfer.
The possibility of connecting more than one
microcontroller to the I2
C-bus means that more than one
master could try to initiate a data transfer at the same time.
To avoid the chaos that might ensue from such an event -
an arbitration procedure has been developed. This
procedure relies on the wired-AND connection of all I2C
interfaces to the I2C-bus.
If two or more masters try to put information onto the bus,
the first to produce a ‘one’ when the other produces a
‘zero’ will lose the arbitration. The clock signals during
arbitration are a synchronized combination of the clocks
generated by the masters using the wired-AND connection
to the SCL line (for more detailed information concerning
arbitration see Section 8).