Help with I2c. AA2315 and TCA9548A multiplexer

Im having a hard time with my i2c config. I have looked all over for a solution and cannot find any info.

Hardware:
Pie zero with wifi dongle
Tca9548a adafruit
2x Aisair am2315

Steps taken and problem:

  • Fresh install of mycodo
  • I2c turned on in menu
  • One am2315 hooked up, works just fine.
  • I have 10k pull down resistors on sensors attached to tca9548a board to 5v.
  • I have tried using 10k resistors on sda1 and sdc1 when attaching it to the pi (even though there already included on the pi), no diff.
  • The tca9548a is powered by 3.3v
  • Sensors powered with 5v

The issue, I follow and use the install script mentioned here GitHub - Theoi-Meteoroi/GPIO-pca9548: Adapt PCA9548 multiplexer overlay to Pi GPIO I2C bus

Confirm it has added the file in /boot and edited /boot/config, reboot

After this with 1, 2 or even no sensors plugged in to the tca9548a when i run i2cdetect -l, it shows this

I2c-1 i2c bcm(i2c@7e8040000) i2c adapter
I2c-11 i2c ffffffff.i2c i2c adapter
I2c-2 i2c bcm(i2c@7e8050000) i2c adapter

Iv ran i2cdetect -y on all 3, none ever show anything even after many scans, the i2c-11 takes forver to scan and pins the cpu to 100%

This is how I would approach using this combination of devices:

  1. Start with a fresh install of the operating system, enable I2C.
  2. Connect each sensor individually and ensure each one works properly by itself.
  3. Connect only the multiplexer and verify it is detected (address appears in the I2C device tree; Note: This does not mean install an overlay. You are merely connecting the multiplexer and verifying it is detected) and works properly by itself and the Python library to control it works as expected.
  4. Connect the multiplexer and a single sensor, use the multiplexer library to select the appropriate channel, and acquire a sensor measurement.
  5. If the previous were successful, connect multiple sensors and use the library to change channels and see if a measurement can be acquired from each sensor.
1 Like

What pins did you connect the tca to? There some ambiguous info in the install script guide that should be corrected by the owner.

This is wrong

i2c-gpio i2c@0: using pins 23 (SDA) and 24 (SCL)

These are not the pins to connect to but the GPIO numbers.
GPIO23 => pin 16
GPIO24 => pin 18

Check this in your setup.

Also, after reboot, do

dmesg

and check if the I2C channels where created.
You should see something like this:

[ 12.726622] i2c i2c-11: Added multiplexed i2c bus 12
[ 12.727381] i2c i2c-11: Added multiplexed i2c bus 13
[ 12.727996] i2c i2c-11: Added multiplexed i2c bus 14
[ 12.728531] i2c i2c-11: Added multiplexed i2c bus 15
[ 12.729070] i2c i2c-11: Added multiplexed i2c bus 16
[ 12.729564] i2c i2c-11: Added multiplexed i2c bus 17
[ 12.730050] i2c i2c-11: Added multiplexed i2c bus 18
[ 12.730627] i2c i2c-11: Added multiplexed i2c bus 19
[ 12.730656] pca954x 11-0070: registered 8 multiplexed busses for I2C switch p ca9548

1 Like

Dmesg is void of all calls like that its one of the first things i have checked, there was a single i2c flag but i dont remeber it exactly.

I used pins sdc and sda nearly identical to this image tca 9548a pi wiring at DuckDuckGo

wire it like in my earlyer message.

Its hard to do this when im unsure what correctly working is suppoosed to look like.

I have done the above as far as i can, before getting to the multiplexer the pi will read either sensor alone no issue, once i get to attaching the multiplexer then using the script, the only thing that changes is it shows the fffffff.i2c as i2c-11 with i2cdetect -l.

Running i2cdetect -y 11 shows nothing ever and as mentioned pins the cpu to 100%.

Adding a sensor to the tca makes no dif, adding 2 makes no dif.

As far as i can see mentioned, once the script is ran it should show i2c-0 ‐ i2c-7 with i2cdetect -l in term and system info.

Im unsure what to even run or do, i work on servers not pis, im very familiar with debian but im just farting around this i2c stuff finding small bits of info everywhere thats conflicting… the python libs needed i see are “python-smbus python3-smbus python-dev python3-dev” correct? Python‐smbus is not avalible, it calls and installs a dif package i dont remeber what it was exactly.

I will try this when i get the chance. Im sure this may be the issue considering im def on the wrong pins then.

I would have done this sooner, but adafruit and all diagrams iv seen never show attaching to those pins. His github mentions it oddly as you stated but i suppose i assumed the wiring would be as shown in any diagram in ref.

rewire and check dmesg.
I made the same mistake. You’ll get there :wink:

Have you performed this crucial step yet?

Do not attempt to use an overlay until you have verified both your sensors and multiplexer are working as expected.

  1. Do sensors work?
  2. Does multiplexer work?
  3. Does overlay work?

You have confirmed 1, but then jumped to 3 without confirming 2.

I will look and see what im able to find without the overlay used and the multiplexer installed.

If the overlay ends up being the issue, you can always access the sensors attached to the multiplexer with the multiplexer Python library.

And to confim, alone with the tca9548a attached to pin sda and sdc of the pi, i should find a decive with the address of 0x70.

One that is confimed i would move the wiring to gpio 23 and 24, power on use the overlay, reboot and then see 8 new channels with i2cdetect -l?

The address can be set from 0x70 to 0x77, but 0x70 is the default.

Just because the device address appears on the device tree, it doesn’t mean the device is working properly. I have mentioned multiple times to test the multiplexer Python library. You can choose not to do this crucial step, but you’re on your own.

Can you mention what steps should be taken to test the python lib?

There are several libraries, so the functions they provide will be different. Here are a few found with a quick search:

You can refer to the README or guide (in the case of sparkfun) for how to use each library.

Did you get it working?

hello,
well did you enable the driver?

To load the kernel driver for the TCA9548A/PCA9548A that ships with raspbian add dtoverlay=i2c-mux,pca9548,addr=0x70 to /boot/config.txt where 0x70 is the i2c address of the multiplexer. If successfully set up, there will be 8 new I2C buses on the [Gear Icon] → System Information page.
after doing that and a restart it works…
if not the multiplexer is broken…
M.