0
\$\begingroup\$

I am building a system that uses expansion boards that communicate with the mainboard MCU over I2C.

I am using an Arduino Nano to test out a few ideas and have come across a problem.

The Nano only has one I2C port. That's fine for my expansion I2C comms, but I also want to use a cheap 0.96 OLED display on each expansion board. These communicate using I2C.

So my issue is that as soon as the expansion is put on the I2C bus, the signals for the OLED at address 0x3C (can't change, and it will be the same on each expansion card) are also going to the bus and getting picked up by the screens on the other expansion cards.

It occoured to me that a filter before the I2C heads to the bus to stop any I2C message with the adress 0x3C would solve my issue; this would keep any messages for the OLED on 0x3C within each expansion card and never make it to the coms bus.

A google search has not yielded any results. A Mux or switch would be too much for my needs here. Any ideas? Is there a magic IC I can program to reject any messages with a set address, i.e. 0x3C?

\$\endgroup\$
5
  • \$\begingroup\$ There are ICs that do something similar. They sort of read and filter out a header address and redirect the rest based on that. They act kind of like a USB hub for I2C. But I doubt anything suitable for what you want but you can look. \$\endgroup\$
    – DKNguyen
    Nov 19, 2022 at 0:00
  • \$\begingroup\$ @DKNguyen any idea the name of these chips? \$\endgroup\$
    – Nick
    Nov 19, 2022 at 0:21
  • \$\begingroup\$ I just remember NXP made them. Maybe they were expanders. But they might also be called hubs. \$\endgroup\$
    – DKNguyen
    Nov 19, 2022 at 0:52
  • \$\begingroup\$ Why not try a software I2C (if any)? \$\endgroup\$
    – Antonio51
    Nov 19, 2022 at 15:43
  • \$\begingroup\$ Take a look at this I2C Mux from TI: ti.com/product/TCA9548A?qgpn=tca9548a \$\endgroup\$
    – T Andersen
    Nov 25, 2022 at 13:08

2 Answers 2

2
\$\begingroup\$

There's I2C bus expander ICs that you can basically address first, tell them to connect one of their downstream buses to your upstream bus, and then communicate directly with the one LED controller you want.

A Mux or switch would be too much for my needs here.

Um, a mux or switch are much much easier than an address-filtering forwarder, which I'm not even sure can easily exist, considering the bidirectionality of I2C through clock stretching being able to disrupt even addresses.

Generally, maybe a microcontroller with only one I2C bus is not the most elegant solution here. Arduino Nanos are relatively expensive for what little they can do. Something like an STM32 "blue pill" board will have multiple I2C buses and the same Arduino IDE support.

\$\endgroup\$
3
  • \$\begingroup\$ Yes I suspect the nano is not suitable for my expansion cards. Its just that I have 5 of them on my desk and want to test my idea.... STM32 might have to do it. The OLED is for the expansion MCU to display what it wants - primarily at this point debug info. \$\endgroup\$
    – Nick
    Nov 19, 2022 at 0:16
  • \$\begingroup\$ yep, sounds like going for a slightly mightier microcontroller pays. Especially since the STM32 also has the nicer CPU, nicer timers (imho), and nicer ADC, plus uses significantly less power if put to sleep when not in use. :) \$\endgroup\$ Nov 19, 2022 at 0:28
  • 1
    \$\begingroup\$ I2C address filters do exist. A device could implement it with MCU and a bus switch like analog mux. If address matches, then switch/mux can disconnect the bus so master does not receive ACK back from target. \$\endgroup\$
    – Justme
    Nov 19, 2022 at 9:50
0
\$\begingroup\$

I2C address translators do exist.

But seriously, for price of one you get many I2C bus muxes.

If you only want to print local debug info from each MCU, don't connect the displays to the common bus between MCUs, but with a separate bus to each MCU.

\$\endgroup\$

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.