Two slaves inhibit each other on i2c

Hi,

I have a larger project structure here: One Arduino Mega, one Diecimila, one Wii Nunchuk and one MD22 Devantech motor controller. They are all connected to the same i2c bus, which the Mega controls as a master. My problem is that the trio Mega/Nunchuk/MD22 works fine, as does the trio Mega/Nunchuk/Diecimila; but when I hook up all four, i2c communication to either MD22 or Diecimila hangs the Mega on the endTransmission() call. So it looks like the Diecimila and MD22 don't want to be on the same bus. Of course, I'd like to know why :-)

There are a couple of oddities about this setup that I can't really fix without a lot of effort:

  • The Diecimila and Nunchuk want 400kbps i2c communication, but the MD22 only handles 100kbps. I do this by dialing TWBR down every time the Mega talks to the MD22, and dialing it up afterwards. As I said, this works fine for the pairs (MD22, Nunchuk) and (Diecimila, Nunchuk) in the same system.
  • The Diecimila, Mega and MD22 are powered by the same power supply that delivers 12V (for the Diecimila and Mega) and 5V (for the MD22). The Nunchuk is powered by 3.3V generated by the Mega.

Since I've written a bit of software for Nunchuk filtering, a PID motor controller for the MD22 and a status transmission and display system for the Diecimila, I'm pretty certain that there's no obvious bug in the communication with either of the components. I've tried test programs that only talk to one of the components, and they also fail when all four are hooked up but work with the three-device configurations.

I'm sure no-one can read that description and tell the error. I guess what I'd like is some help on how to go about debugging this. I'm just a computer scientist, I know little about electronics :-)

Thanks a lot in advance, Björn

The Diecimila, Mega and MD22 are powered by the same power supply that delivers 12V (for the Diecimila and Mega) and 5V (for the MD22). The Nunchuk is powered by 3.3V generated by the Mega.

This means that the I2C bus will be at 5V this will upset the nunchuck as it only needs 3V3. You can try disabling the pull ups in the library and having an external pull up to 3v3 only, I think the 5V devices will cope with this.

Yes, I figured so. But it works with two 5V and one 3.3V devices on the bus, why doesn't it work with three 5V and one 3.3V devices?

EDIT: Would it be possible to just disable the pullups in both Arduinos (and maybe desolder those in the MD22)? The Nunchuk has its own 1k8 pullups, which would pull the bus up to 3.3V.

EDIT: Argh Forget it It works now Note to self: Do NOT enable interrupts on pins you do communication on.