Black Lives Matter - Action and Equality.
0

MLX90393 and TCA9548A
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MLX90393 and TCA9548A

by bludin on Mon May 18, 2020 5:46 pm

On an itsybitsyM4express with circuitpython 5.3, I'm trying to use a MLX90393 magnetometer behind a TCA9548A I2C switch using the adafruit_mlx90393 and adafruit_tca9548a modules from the adafruit-circuitpython-bundle-5.x-mpy-20200415 library bundle. Unfortunately, when I initialize the MLX90393 using a TCA9548A channel object...
Code: Select all | TOGGLE FULL SIZE
import board, busio, adafruit_mlx90393, adafruit_tca9548a

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
tca = adafruit_tca9548a.TCA9548A(i2c)
mlx = adafruit_mlx90393.MLX90393(tca[7])
...
...the program just stalls without throwing an exception :-/ (although the same approach works fine for other sensors).

However everything works fine when I switch the TCA9548 "manually" and initialize the MLX90393 with an I2C object:
Code: Select all | TOGGLE FULL SIZE
import board, busio, adafruit_mlx90393

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
while not i2c.try_lock():
    pass
buf = bytearray([0x80,])
i2c.writeto(0x70, bug)  # set the TCA9548A (addr=0x70) channel
i2c.unlock()

mlx = adafruit_mlx90393.MLX90393(i2c)
...
Thus I would conclude that the hardware works just fine and the problem is on the software level.
Would anybody know how to fix that?
TIA, Beat

bludin
 
Posts: 8
Joined: Thu Apr 16, 2020 8:57 am

Re: MLX90393 and TCA9548A

by adafruit_support_carter on Mon May 18, 2020 6:48 pm

Thanks for pointing this out. Not sure what it is, but was able to recreate it. Issue opened here:
https://github.com/adafruit/Adafruit_Ci ... /issues/19

adafruit_support_carter
 
Posts: 15647
Joined: Tue Nov 29, 2016 2:45 pm

Re: MLX90393 and TCA9548A

by adafruit_support_carter on Fri May 22, 2020 4:57 pm

This appears to have been a bug in the MLX library. Please try updating to the 1.4.2 release when it becomes available:
https://github.com/adafruit/Adafruit_Ci ... /tag/1.4.2

adafruit_support_carter
 
Posts: 15647
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.