[Semi-Solved] Due and uno in multi master I2c

I have spent all weekend with this and am at the point of tearing my hair out.

I am using a minor varient of Arduino : howto master to master I2C | Blog Michael BOUVY

Between a Due and a Uno.

I have put a logic level converter between SDA & SCL between the two boards.

The only real change I have done (during debugging) is on the UNO is to delay only 1 second between sending and on the DUE wait 5 seconds between sends.

What I observe is on the DUE, 5 receives come in (Perfectly). Then the delay on the DUE expires and it sends to the UNO it's packet.

The UNO appears to 'stall' in the ReceiveI2c event (I did a little change to tun on the inbuilt LED at start of routine and turn it off at the end.

I am awaiting some NANO's so I can run this without the DUE (Which I suspect is causing the issue - when it does the send).

Unfortuantly I don't have a logic analyser to fully debug what is going on!

Q1. (I had to take the serial sends out of the Uno because for the life of me I cannot work out how to have 2 serial monitors running at the same time (1 for each board) - I am on OSX and have the latest ARDUINO environment (1.5.7 I believe (I am at work so cannot verify).

Has anyone else managed to get multi-master working with DUE and UNO - or am I just wasting my time?

The level converters appear to be working because the DUE can successfully receive from the Uno.

I suspect the Due should be set up as a master with no address - I believe this will mean that the DUE is the master clock reference - but if I do this, what address would I use on the UNO to send back to the Due (Zero?).

Apolegies for the long post - I am a newbie with the arduino!

Stan

Little bit more info - which may be a clue.

I downloaded and looked at wire.cpp in the latest overnight build. The end_transmission takes a parameter to send a stop - but for the life of me I cannot see if this paremeter gets used.

I have seen mention of changes to the wire.cpp and can see some code on github where it appears to use the parameter - but I am unsure on the relationship between the libraries shipped with the arduino IDE vs what is on github.

I could download the github version - but don't want to break anything.......

BTW - FWIW for OSX at least, I found a resolution to displaying the serial from two Arduino's simultaniously - see Is there an OS X terminal program that can access serial ports? - Ask Different

I used the script/screen option and it works great (don't forget to ctrl/D and exit it prior to downloading new sketches into the arduino!

Stan

May have been premature - just re-downloaded the nightly build and in the hardware/AVR tree the wire.cpp does appear to handle the stop on end_transmission.

Doh!

Stan

OK Now got the Due and Uno working nicely in master/slave mode

Turns out I may have fried SDA and SCL on the Due by 'accidentally' putting 5v on the lines - don't ask.

Switched to Wire1 and all is pretty good.

Occasionally I get a status 2 from the end transmission - suspect this is a NACK due to bus contention (according to the library, this status is only returned at the start of endtransmission so the data to be sent is still in the buffer.

Will attempt a small delay and retry end_transmission if I get this and will if this all works post the sketch and diagram with the level converter I am using.

Am ordering a logic analyser and when it comes will re look into master->master and see what is happening.

Re analyser - am tossing up between salesea Logic 8 or Logic 16. The logic 16 will obviously allow more lines to be checked - say if I am using my liddle tiny camera which uses i2c and SPI - but still tossing up between the two at the moment (the 16 is much more expensive due to what we call the 'Australia Mark-up' - but I am not sure if I want to wait for it to come from overseas - along with the horrendous shipping charges....)

Stan