Open vveliev opened 5 years ago
Your connection is probably correct, but unfortunately it will not work because arbitration is broken. The library currently does not handle ARBL properly, and I've never had a chance to fully investigate and fix it. It will be some time before I can try again to fix it, so I don't have a short-term fix. You can try the default Teensy Wire lib to see if that gives a different result.
However if your goal is simply to communicate between two Teensy devices then there is a workaround. Instead of running a half-duplex connection on one bus, you can split to single-direction on two buses. For instance: Device1(Wire) --> Device2(Wire1) Device1(Wire1)<-- Device2(Wire)
whereby on a given device Wire is the Master Tx and Wire1 is the Slave Rx. The penalty of this is if you are also adding additional Slaves on the bus, one Master device will not have visibility to those Slaves (it would have to relay through the Master which can see them).
No Wire lib was my first option and it did not work.
Well, I have implemented the pulling on one master(teensy) instead. It's just unfortunate there it's not mentioned that multi-master configuration is not supported by the library.
If I will have time and brains to figure it out will open PR.
Thanks.
I have issues using this lib with multi-master configuration:
The example code provided below(if replace with Wire lib, the code does work on Arduino uno/mega)
Master1:
Master 2:
I2C bass spesifications tells me that it should be working hardware wise. https://www.nxp.com/docs/en/user-guide/UM10204.pdf