I have several slave devices communicating with a microcontroller master on an I2C bus. My PCB is only about 1" x 1" and the devices are only communicating at 400 kHz. What is the best way to connect all the I2C peripherals to the microcontroller? In a star configuration or in a daisy-chain configuration?
4 Answers
Propagation delay is not a problem with a 400kHz I2C bus on a 1" by 1" PCB. Lay the traces out in whatever way gives the cleanest routing.
A rule of thumb in EMC design is that you need to consider transmission line effects if your traces are 1/10 the wavelength of your highest significant frequency.
Your highest significant frequency in I2C, which uses pullup resistors, is the fall time. That's usually on the order of 100ns when controlled by a microcontroller with fairly fast I/O. The primary frequency of the 100ns fall time is 5 MHz (which, you'll note, is much greater than 400kHz).
At 5MHz the wavelength is on the order of 100 meters. The rule of thumb says don't worry about it until you get close to 10 meters.
-
2\$\begingroup\$ +1 for identifying the factors in play, but how does 100ns equate to 2.5 MHz? I'd expect significant content at 5 MHz and 15 MHz. \$\endgroup\$ Commented Aug 31, 2011 at 20:23
-
\$\begingroup\$ @Ben - Whoops, I was messing with estimated fall times and got something confused. Thanks for checking my math. \$\endgroup\$ Commented Aug 31, 2011 at 22:25
In your case (1x1 inch, 400 kHz) it doesn't matter. The pullup resistors can be anywhere on each net, and your main issue can be routing simplicity.
The only thing to watch out for is capacitive coupling if you've got other nets with high dV/dt. Just keep somewhat away from those, or for extreme cases, put a deliberate ground trace between the IIC lines and the very noisy lines (probably between the noisy lines and anything else in your circuit if it's so bad to need this).
-
\$\begingroup\$ Thanks for the coupling reminder. I might dedicate a whole layer (sandwiched between planes if I can) to these in my PCB just to make sure it's not a problem. \$\endgroup\$– Joel BCommented Sep 1, 2011 at 23:44
-
\$\begingroup\$ @Joel: Again, this is not likely a problem unless you have unusually high dV/dt, like what a inductor can produce when it is turned off abruptly as happens regularly in a switching power supply. \$\endgroup\$ Commented Sep 2, 2011 at 11:21
At that size of PCB, and bit rate, just connect them up in whatever way that makes PCB routing easier. Star vs. Daisy Chain won't really matter.
Even if your PCB was 10" x 10", the topology still wouldn't matter much.
For reference Intel recommends a star configuration to limit load capacitance:
I2C Routing The I2C signals do not need to be routed as differential pairs, but it is recommended not to separate data and clock lines too much. It is not required to route the bus as a daisy chain, because the stub length is not a problem. The maximum trace length is limited by the load capacitance of the traces and attached bus devices. Keep traces short by using a star topology.