hey @ShaneCCC,
On my system I got several subfolders under /sys/bus/i2c/devices/
from i2x-0 all the way up to i2c-9
Which one should I update?
Also, when booting the Jetson in command line mode ( sudo systemctl set-default multi-user.target), I can see this output every time I’m running my python app:
The app works fine in the end, and I’m getting data from the sensor. But I suspect the long connection time to the sensor has something to do with the above errors/timeouts.
Again, those are not visible when running my app from a terminal in GUI mode, and are not part of my program output, they seem to be printed by the system in the background. so I was unable to copy/paste them here or store in a log file, only take a photo.
I’m getting similar errors on both, Jetson Xavier NX and the Jetson Nano Dev kits.
Each kit has its own VL6180X sensor connected to it.
Could both kits and both sensors have the same hardware problem?
The easy way to check I2C port is to probe the output I2C signal to confirm if the waveform is correct. In general, the I2C port on Jetson should be no problem since it is validated before ship out. So please check the external device’s setup to make sure it is power up correctly, its IO level match with Jetson’s, it is initiated correctly etc…
I tested 4 different VL6180X sensors with 3 different Jetson Boards - 1 Jetson Nano Dev Kit and 2 different Xavier NX Dev Kits. The case was the same across all tests:
The initial connection to the sensor takes about 10 seconds, once established the data flow is stable and quick.
I made the same test on a Raspberry Pi, with the same sensors and the initial connection to the sensor takes 0.02 seconds. So I think the sensors work fine.
Here is my test code:
import time
import board
import busio
import adafruit_vl6180x # TOF Sensor
class SensorsFeed:
def __init__(self):
self.i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
print("connecting to range sensor...")
self.rng_sensor = adafruit_vl6180x.VL6180X(self.i2c)
print("Sensor online!")
def get_range(self):
sensorVal = self.rng_sensor.range
return sensorVal
if __name__ == "__main__":
start_time = time.time()
sensors = SensorsFeed()
print(f"Took: {time.time() - start_time} sec.")
start_time = time.time()
print("getting measurements")
for i in range(10):
print(sensors.get_range())
print(f"Took: {time.time() - start_time} sec.")
Here is the output on the Jetson (Initial connection takes 10s):
connecting to the range sensor...
Sensor online!
Took: 10.185436964035034 sec.
getting measurements
72
72
73
73
73
70
72
73
69
73
Took: 0.16100001335144043 sec.
Here is the output of the same code on the Raspberry Pi (initial connection takes 0.02s):
connecting to range sensor...
Sensor online!
Took: 0.025896072387695312 sec.
getting measurements
51
51
52
53
54
54
53
54
54
53
Took: 0.11930608749389648 sec.
@ShaneCCC
“SensorsFeed” is a class (declared at the beginning of the code) which holds the sensor-related functions.
So sensors = SensorsFeed() creates a new instance of this class and stores it in the “sensors” variable. When an instance of a class is created it automatically calls the __init__() function within that class.
In this function, I establish the connection with the sensors, and that’s the part which takes quite long ~10 seconds on the Jetson.
To be more specific the line that takes 10 sec is:
Yes, running an i2c scan on the Jetson sudo i2cdetect -y -r 8 on the Xavier NX or sudo i2cdetect -y -r 1 on the Nano takes ~1 second to perform the scan and it finds the sensor on address 0x29 with no problems or delays.
I don’t think this loop is being accessed in the connection init phase as it seems to be part of the range reading property which works fine with no delays.