pimoroni / vl53l1x-python

Python library for the VL53L1X Laser Ranger
https://shop.pimoroni.com/products/vl53l1x-breakout
94 stars 53 forks source link

Two TCA9548A wied with Jetson Nano,independently access successfully , but failed when access rotationally #45

Closed hzlijianjun closed 1 year ago

hzlijianjun commented 3 years ago

We know that Jetson Nano has two I2C bus, I wiring one TCA9548A with each bus on JetsonNano, and each TCA9548A wired with some vl53l1 sensors. I can access each group sensor by TCA958A independently in one run test, but failed when I access these tow group sensors. My program logical as following:

''' Initializing and start_ranging firt group vl53l1s wired with TCA9548A at bus 0 ''' mode = 1 devices = [] for num in [0,1,2,3,4,5,6,7]: tof = VL53L1X.VL53L1X(i2c_bus=0, i2c_address=0x29, tca9548a_num=num, tca9548a_addr=0x70) tof.open() tof.start_ranging(mode) devices.append(tof)

''' Initializing and start_ranging second group vl53l1s wired with another TCA9548A at bus 1 ''' devices2 = [] for num in [0]: tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29, tca9548a_num=num, tca9548a_addr=0x71) tof.open() tof.start_ranging(mode) devices2.append(tof)

''' Then start access first group sensors, it is success ''' for i in range(len(devices)): print(devices[i].get_distance())

''' Start access second group sensors, it is success ''' for i in range(len(devices2)): print(devices2[i].get_distance())

''' Access first group sensors again, it is failed! ''' for i in range(len(devices)): print(devices[i].get_distance())

Then error information as following:

_Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' File "/usr/local/lib/python3.6/dist-packages/VL53L1X.py", line 151, in _i2c_multi self._i2c.write_byte(address, reg) File "/usr/local/lib/python3.6/dist-packages/smbus2/smbus2.py", line 393, in write_byte ioctl(self.fd, I2CSMBUS, msg) OSError: [Errno 121] Remote I/O error i2c bus on multiplexer not set.

Help me please, thanks in advance!

Gadgetoid commented 1 year ago

Afraid I don't have any experience with, hardware to test or or bandwidth to support Jetson Nano. Sorry.