I had a late night reflexion about I2C communication with more than 2 devices in a multi-master network. I made a videocast that explains the whole idea. However, my first real-life experiments has raised important synchronization issues with respect to I2C communication in multi-master networks.
The problem can be explained as follow: in a multi-master network containing 3 or more nodes, there is a risk of corrupted data as two masters can write on the same bus. Suppose you have three nodes: A, B and C. A has initiated communication with B and has requested some data from it. It then gets this data using the Wire.receive() function. However, in the mean time, C sends data to A. Then the data A is expecting from B will be corrupted by C. (yeah and, by the way, the network on the image isn't really working, because of that)
There is a very nice I2C FAQ that discusses these issues. In particular, the article Using the clock synchronizing mechanism as a handshake explains how to solve the issue, however it is very low-level and would require adding some new functionalities to the Wire library. See also this article.
So for now I see two ways to go with this project:
Anyway, I believe I'll drop it for now and start working on a simple chained serial communication network.
Post new comment