0

I'm looking to network a bunch of devices (boards in a Eurorack case) over I²C, but I don't want to compromise the address space available to each individual device for its own needs. The obvious solution here is to give each device its own I²C bus which it controls, and then connect them together over another.

Two independent I²C connections would be needed on a microcontroller in this setup, and if I understand the datasheet correctly, the MCU on the Arduino Nano Every can act as host on one bus and client on another using the Dual Mode setup of the Two-Wire Interface (see Chapter 25 of the linked datasheet), but the board only exposes two sets of I²C-capable pins and they are wired together in the schematic.

What steps would I need to take to coax another I²C connection out of an Arduino Nano Every?

4
  • ATmega4809 only has one hardware i2c interface. If you need a second i2C, you can use any GPIO pins as i2c pins and create software i2C (bit-banging) yourself, or find some software i2c library online. You can also buy i2c expander/extender as a hardware solution.
    – hcheung
    Commented Aug 20, 2022 at 1:35
  • If that's the case, what exactly is the dual mode for? The host and client capabilities patently cannot use the same bus independently, as I²C is only half-duplex, so if what you say is true the datasheet seems to be misrepresenting the 4809's TWI. Commented Aug 20, 2022 at 16:52
  • If you're asking about hardware supported I2C/TWI, then you seem to have answered your own question. So, you could post an answer that says "No, not without modifying the board." For what it's worth, I don't understand the devices involved and the topology and direction of data flow well enough to know that modifying the board would ultimately help you anyway. Same for using an I2C multiplexer.
    – timemage
    Commented Aug 20, 2022 at 18:56
  • ATmega4809 datasheet does not misrepresenting the TWI. Dual mode does not mean two TWI ports, it means that you can have two set of TWI wires, one for master and one for slave, internally it controlled by setting the registers, you can think as there are two STDP switches controlled by the PORTMUX register that switch between master and slave wires. Read "15 PORTMUX" and "25. TWI - Two-Wire Interface" of the datasheet to understand the dual-mode TWI.
    – hcheung
    Commented Aug 21, 2022 at 3:09

1 Answer 1

1

Welcome!

Theoretically you can connect 127 devices to the I2C bus. I suggest you do a little reading on the I2C bus before you start your design. Hopefully all of these I2C devices are on the same board but since you want to network them I have a feeling you are making a very painful mistake. I2C was never intended to be used for networking.

For a bunch of devices I would seriously look at CAN, two wires to connect them is all that is needed even for well over 250 meters or 800 feet with the baud rate of 250 kbit/s. I usually also run a ground. This will be much faster than the I2C. CAN is a simplex communication mode that turns around very fast. Each node can send and receive under software control. It does its own arbitration no need to worry about it the controllers do it for you.

2
  • I considered CAN, but I thought it a little overengineered for what I'm trying to achieve. I've clarified the question, as I didn't make it clear that the length scale is shorter than the verb "network" would suggest. Commented Aug 20, 2022 at 17:01
  • You will probably have to shield the I2C bus as that many on an audio mixer will create noise. You may also have to slow it down because of bus capacitance. Let us know how you do.
    – Gil
    Commented Aug 20, 2022 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.