I2C devices interfering

kitmech
Posts: 2
Joined: Mon Nov 06, 2023 10:24 am

I2C devices interfering

Postby kitmech » Mon Nov 06, 2023 10:56 am

Hi all,

I am having some issues trying to get several devices to share the I2C bus.
Two of them don't play nicely together, and I am at a loss as to why.

Devices:
MCP23017 on address 0x20
ADS1115 on address 0x48
GP8302 on address 0x58
(I have verified these addresses with I2C scanner)

The ADS1115 ADC and the MCP23017 MUX work fine together, and the GP8302 will work great with the only the ADS1115.
But the The GP8302 will not function when the MCP23017 is init - it appears to start, but will not produce an output. The MCP23017 works fine.
Note that all devices remain connected, the only difference is which ones I initialise. To test I simply comment out the appropriate begin(), and any areas where the code would try to use that device.

The ADC and MUX are built in to my custom PCB, but the GP8302 is a DFRobot DFR0972 4-20mA DAC breakout.
My PCB has 10k pullups to 3V3 on the SDA and SCL. The DAC has 4.7k pullups according to its schematic.

I am using the Adafruit libraries for the MCP23017 and ADS1115, and the DFRobot library for the DAC.
I have also tried a different library for the MUX, same issue.
I am happy to post my code, if you let me know which region of it you would like to see as it is fairly extensive.
I do not have any other pins of the ESP32 exposed on my PCB, otherwise I would try to put the DAC onto the other I2C bus. I tried to use TX and RX (pins 1 and 3) as they have pins to connect to for programming of course - but couldn't get that to work either.

Does anyone have any ideas why the GP8302 doesn't work on the same I2C bus as the MCP23017?
Any tips on where to start looking would be appreciated.

Thank you very much for any help!

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: I2C devices interfering

Postby lbernstone » Mon Nov 06, 2023 4:59 pm

The more elements you have on the bus, the greater the capacitance. Read section 7 of the I2C bible document to help you properly size your pullup resistors:
https://www.nxp.com/docs/en/user-guide/UM10204.pdf

kitmech
Posts: 2
Joined: Mon Nov 06, 2023 10:24 am

Re: I2C devices interfering

Postby kitmech » Tue Nov 07, 2023 2:51 am

Thank you very much for the reply and link to great documentation!
I will spend some time reading through that...

However I am not sure that capacitance could be the issue - the circuit is physically unchanged during my testing, all the pullup resistors are present in each case. Surely if that was the issue the GP8302 would work at all?

Thanks again!

shaciaran
Posts: 1
Joined: Tue Apr 23, 2024 8:42 am

Re: I2C devices interfering

Postby shaciaran » Tue Apr 23, 2024 8:47 am

Hey kitmech,

Did you find a solution to this? I'm also having trouble with the GP8302 not sharing I2C.

It looks like the DF Robot library manipulates the I2C pins directly, where most other peripherals use the Wire library. As soon as Wire.begin() is called the GP8302 isn't accessible. I assume this is the problem but I don't know how to get around it, I haven't found an alternative library for the GP8302.

Who is online

Users browsing this forum: No registered users and 39 guests