I2C Communication With Up To 10 Devices

Hello,

I'm working on a project that uses Multi-Master I2C communication between ten (10) Arduino Megas and could use some advice. This is going to sound like I'm asking you to debug my code, but this is more just giving you a good idea of the general scope of my project and some concerns I have with it.

One device is used as user input that sends four (4) bytes of information upon button press to six (6) of the other Megas for controlling the position of multiple motors (6 per arduino, totaling 36 motors in this system). Those (6) motor controllers then send position data to the three (3) remaining controllers for monitoring.

Overall, a lot of bytes of information are being sent. Ultimately, the user input arduino is sending 4 bytes of information upon a button press, and the others are sending 36*5 bytes of information continuously, not including the timing bytes for clock.

I have a rough test set up for operation with the user input controller, a single controller for motor operation, and a single monitoring controller. It currently works, but occasionally, upon user input, the motor controller stops functioning. I believe it is due to the receiveEvent interrupting the transmission to the monitoring controller. It seems to fail to receive the incoming data as well as restarting the communication with the monitors.

Is there a way or method to ensure that the processes don't get interrupted? Maybe a way to ensure that the user input doesn't attempt to send until the line is clear? Is this a timing problem? Is I2C communication not fast enough to handle the scope of my project?

Any thoughts, comments, or criticisms?

Thank you ahead of time.

What multi master libary are you using? The standard arduino wire libary is not a multi master one.

Grumpy_Mike:
What multi master libary are you using? The standard arduino wire libary is not a multi master one.

I am actually using the Wire.h library. According to a few other forum posts (like this one), it seems that the Wire.h library is multi-master capable. Documentation is just terrible on the library.

Plus I have actually gotten it to work (aside from the sporadic crashing). I haven't assigned any of the arduinos as the master and it seems to function well enough.

Although, are there other libraries that you might be able to recommend me to look into that may address my concerns?

Would changing the clock speed in the Wire library make the I2C transfer faster allowing for more time to send the signal without interruption?

it seems that the Wire.h library is multi-master capable.

As I understand it it will not implement a multi master system correctly and it suffers from exactly the problems you are experiencing.

perman:
Would changing the clock speed in the Wire library make the I2C transfer faster allowing for more time to send the signal without interruption?

No you still have the same problems of bus arbitration and collision detection.

This link might be helpful:-