I'm having trouble putting two I2C devices on the same bus. I'm using an Arduino Nano EVERY to communicate with an MCP4725 and an Arduino MEGA. I'll post a basic program down below that will reproduce the failure. Both have unique addresses. The program seems to stall at either the 'dac.begin(0x60);' or the 'Wire.requestFrom(SLAVE_ADDRESS, 2);' whichever is first in the program. Everything works as it should if either one of the I2C devices is connected while the other isn't. Or if both are connected the MEGA needs to be powered on first before the EVERY. The opposite order stalls the program. One mistake from the schematic pictured the MCP4725's A0 line IS tied to GND. Any help finding and correcting where I've messed up or pointing me in the right direction would be greatly appreciated. Let me know if any more information might be useful. Thanks!
The MEGA is running a display using SSD1963 controller. In my main program there is a lot more going on on the EVERY and that sends data to the mega to be displayed.
I might be confused about what you're trying to tell me. The MEGA is powered externally, while the EVERY is powered by USB. The lines that are connected between them are the SDA, SCL, and GND. It's sounding like that isn't good practice, and suggestions on how to make it better?
Thanks.
Power them up simultaneously, and you should be OK. There is no good way to protect the I2C bus from the problem.
I2C was designed for chip to chip communication on a single PCB, and is a very poor choice for interprocessor communications. Communication is noise sensitive and does not tolerate long leads (more than a few cm).
I strongly recommend that you switch to UART serial for that. That way you can also protect the devices from damage if one is powered down. Use a 10K series resistor to limit current from an I/O output pin on a powered device to an input pin on an unpowered device.
Thanks for the advice. I'll look into switching to UART Serial communication. In my main program I also have the EVERY communicating to a LabView program on the PC. I'm assuming this is using UART Serial to communicate (it's done through all of the normal Serial commands) is there a way that you know of to define what the EVERY sends to the MEGA and what it sends to the PC?