I2C port access via PCA9548 multiplexer #13226
Unanswered
ADenislebel
asked this question in
Hardware & Peripherals
Replies: 1 comment 1 reply
-
I do not see the need to use both SoftI2C and hard I2C. Since the I2C object hast to be supplied to the HTU21 driver, you can use the same I2C object to control the MUX independent from the driver. The HTU21 code does not have to be changed. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I attempting to read 4x HTU21 sensors via a PCA9548 multiplexer and I'm getting failures of the I2C function that access the sensors. The HTU reading scripts I got @ https://github.com/flrrth/pico-htu21d/tree/main work fine after the hardware is first initialized but once I attempt to change the multiplexer port to allow the same code to read the next sensor then I get a failure
of the HTU21D.py script. Shown below the error message in Thonny that is generated. All the line number are from the HTU21D script:
0 b'1' # a print showing the multiplexer channel setting for chnl 0 with port value 1
Traceback (most recent call last):
File "", line 80, in
File "", line 73, in get_loc_rdgs
File "", line 51, in rd_htu_chnl
File "htu21d.py", line 24, in init
File "htu21d.py", line 29, in reset
AttributeError: 'NoneType' object has no attribute 'writeto'
I believe the problem is related to the fact that both I2C access for the mux and the htu must share the same port. The HUT21 script uses the hardware I2C so I attempted to use the SoftI2C for the mux both then I get an Unable to import error. When I use the hardware I2C for the mux then the failure happens when I re-initialize the mux I2C on every channel change.
So any taught or suggestion. I'm hoping I don't need to mess with the HTU21 code as it otherwise works fine for me. Beside the 9548 Mux is a single byte write to set the channel and single byte read to confirm its channel.
Thanks...Denis
of micropython The H
Beta Was this translation helpful? Give feedback.
All reactions