Board-to-board I2C communication (design question) - Page 1
Forum section: electronics / projects

author: pini.grigio
author_rank: Contributor
timestamp: November 26, 2023, 08:05:47 am
content: Hi,In my current project I have designed a board which houses an RP2040 and a led matrix driver connected via I2C (configurable address).The board is a led matrix display, which should work on its own, but also as part of a larger matrix comprising multiple identical units.For that purpose I plan on connecting the I2C bus between all boards together, have one board act as the master (communicating with all the led drivers over I2C) and the rest as slaves which only set a certain GPIO pin and then go to sleep.I have several challenges/questions regarding this setup:1. How safe/reliable is it to run multiple MCUs connected to the same I2C bus? Would putting the MCUs to sleep after booting be sufficient to preventing them from interacting with or affecting the I2C bus?2. Each board's i2c bus is pulled up with 2k resistors - this means I can't just directly daisy chain the buses or I'd be losing pull-up strength3. I'm not sure how worried I should be about capacitance issues, I have about 10cm of traces and 15cm of cable between each board.It seems to me that I could solve all the above problems by buffering the i2c bus but Im not quite sure what would be the most simple and effective setup.I've looked at several common ICs and they each have some limitations associated with them, for instance multiple PCA9515 cannot be used in series.Is there a simple bi-directional buffer that I can use? Would I be better off just using two p-channel fets?I'll appreciate any input on this!Thanks

author: moffy
author_rank: Super Contributor
timestamp: November 26, 2023, 10:34:59 am
content: Perhaps an I2C hub is what is needed:https://www.ti.com/lit/ds/symlink/pca9518.pdf?ts=1700994798663&ref_url=https%253A%252F%252Fwww.google.com.au%252F

author: David Hess
author_rank: Super Contributor
timestamp: November 26, 2023, 03:56:31 pm
content: Quote from: pini.grigio on November 26, 2023, 08:05:47 amSleep is fine as long as the MCUs are still powered so their output ports remain under control.QuoteWouldn't you be gaining pull-up strength?If each bus has its own pull-up, then connecting them all together will be a problem unless some of the pull-ups can be removed.Are the master and slave boards identical? If the slave boards all connect to the master, then I might use an analog multiplexer on the master to divide the I2C bus up.QuoteThe I2C specification is 400 picofarads maximum. I would figure about 50 picofarads per meter.

author: slugrustle
author_rank: Frequent Contributor
timestamp: November 26, 2023, 07:15:31 pm
content: I2C really isn't suitable for this use case, I don't think. It's not meant to run over long cables, has a maximum limit on capacitance, the positive drive comes from pullup resistors, and it's non-terminated single ended logic.Things like RS232, RS485, LVDS, and CAN are more suitable for runs between boards. If you only have one master and don't need the other boards to send information back, then a single twisted pair could work. I'd recommend RS485 since it is very reliable and I2C had enough bandwidth for you. Put a single transmitter on the master side, run the differential pair as traces (laid out as a diff pair with appropriate impedance) and twisted pair from the master board to each subsequent board in the chain, then terminate at the very end of the chain with a 100Ω resistor.If you don't know how many boards you'll have or if you might want to expand this later, you can put a termination resistor on each board with a jumper to enable or disable it. The termination resistor should be at the very end of the transmission line, farthest from the transmitter.