I'm designing an arduino based board which will uses I2C port a lot. I want to be able to connect several slave devices, and/or connect several mother boards together (at least 4 would be great). The I2C will run at 400kHz @ 3.3V. The flat cable between the boards can be up to 2 meter long.
Edit : When I say I plan to use 4 main boards at the same time, only 1 of them will be the master/host.
- Pull up resistors
My problem is not really about choosing the right value of the pullup resistor (for that I found this interesting article). It's more about "design patern".
According the aforementioned article, I should use resistor between 4.7kR and 1.5kR. It's ok as long as I only have one main board with its pullups and slaves with no pullups, but if I connect several main boards together, the pullup resistor will be in parallel, and then too low.
Should I add some jumpers to enable/disable the pull-up resistors ? I don't like this solution at all, it takes space on the PCB and is not handy. And I want my board to be easy to use, just plug things together and everything works.
If I use 4.7kR resistors and hook up 4 main boards together, I will have a equivalent pullup of 1.2kR, which is pretty low, and then it will consume more current (my device is battery powered), the devices will have to sink all that current (I can't predict the sink capability of the slaves that will be connected to the I2C port).
- Shielded cable
Should I use shielded cable between devices as it will be quite long (up to 2 meters) and the voltage quite low (3.3V)?
Finally, I didn't found any "regular" I2C connector. The most common seems to be 4 pin SIL connector with pins in that order : GND, VCC, DATA, CLOCK (on seeed's grove or tinkerkit for example). Sounds good to me, but any suggestion is welcome.
Bonus question : should I write "I2C" or "TWI" on my PCB ? According to wikipedia TWI seems to be an incomplete implementation of the I2C protocol. Tinkerkit uses "TWI", but "I2C" seems to be more common in electronics.
wire capacitance is what you are fighting - you can only go as fast as you pullup resistors can charge the parasitic capacitance of the wires - in the real world you make a good guess and then once you start working with the circuits drop a 'scope on on the data line - if you see a bunch of nice square waves you're good to go. On the other hand if you see a bunch of shark fins some of which don't make it all the way high before the clock edge you're either going too fast or need a smaller pullup