I2C bus arbitration - communication layer
I2C arbitration works at the datalink level. I2C uses open-drain connections: SDA is low if any device pulls it low, but SDA is high only when all devices are not pulling it low. So during I2C slave address where two masters are transmitting, if one master pulls SDA low while the other master wants SDA high, then the open-drain datalink resolves the conflict in favor of the low value. Whichever master is transmitting the higher-numbered slave address, lost the I2C arbitration and must immediately release the bus. This only works if both I2C masters detect during each bit transfer that SDA is in the requested state. Not all I2C implementations are compatible with multi-master systems. A software bit-banging I2C master might not support multi-master address arbitration.