I came across an I2C article which lead me to a question. Specifically this part is creating some confusion:
"Also, unlike SPI, I2C can support a multi-master system, allowing more than one master to communicate with all devices on the bus (although the master devices can’t talk to each other over the bus and must take turns using the bus lines)"Sparkfun
Why can't masters talk to each other in a I2C bus if you supposedly have an unique address bit for each of the devices connected to it?
A master starts a transaction by outputting the clock signal and the slave address.
A slave starts a transaction when it detects a clock signal and its own slave address.
Only one device can control the clock. Therefore, an I²C transaction always must be between a master and a slave.
It is possible for multiple devices to talk to each other while initiating transactions on their own, but this requires that they stay in slave mode while idle and listening, and switching to master mode only when they want to start a transaction.
Only one master can be active at once - this means that a master can only talk to slaves and slaves can appropriately reply. If a slave were formerly a master then you could say there was a form of master-master communication. To have a multi-master scenario, there has to be relinquishment of master status by one device and acceptance of master status by another device. You can't have two masters without some form of "understanding" between the two.
But it is down to the protocol - you could make an argument for a system that contained devices that were all capable of being masters and you could devise your scheme such that a master communique to a slave could contain a "bit" that indicated that the slave should "take over" being master. That slave could then reply like a master (to the former master) and so on and so forth. This would pretty much look like master-master communication but, if you really examined things, it would still be master-slave comms.
An I2C Master does not have an address, only slaves have addresses.
All of the transactions on an I2C bus are pushed from or pulled to the master under the master's control.
However there is nothing to stop you from programming your masters to be 'dual-mode' devices and switch between master mode and slave mode on the fly.
Perhaps you could set up a system where all of the devices on you I2C bus default to being slaves (with addresses), but when one of them wants to initiate communication it switches to master mode & grabs control of the bus.