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