I2C Multi-Master Network?

I've been tinkering with an Arduino for a while now, and have happily got it talking to a variety of devices, and now an I2C RTC.

I have two Arduinos running different 'halves' of my application. Let's call them A (the slave) and B (the master). There's also an I2C RTC.

I'm wondering if there's any way I can have the slave (A) occasionally be a master so that it can get the time from the RTC. The rest of the time, it'd be a slave, waiting for the real master (B) to tell it what to do.

Of course, it's possible I could have the master (B) get the time and then push that into the slave (A), but that seems rather round-about to me. I can imagine that if both masters start talking at the same time Bad Things could happen, but I can't find anywhere to confirm.

Any ideas? Thanks for your help!

Hi,
you are right things will happen if you have two masters on the bus at the same time.
You get an error code from Wire.endTransmission for a failed transmission (you have to check the library sources for the error type), but the much easier solution is to have the a single master controlling the bus.

Don't be cruel to yourself :slight_smile:
Eberhard

Thanks for the confirmation.

So it looks like it's technically possible, although with quite a bit of exception handling, and possibly a light protocol layer to back off and wait after an error etc. In other words, it's quite nasty.

Thanks again - I think I'll keep it simple :wink: