Question concerning issues developing drivers for VL6180X tof sensor


I recently purchased the VL6180X Time-of-Flight Distance Sensor Carrier with Voltage Regulator for short-distance measurement in a personal project. I am using the sensor on the Jetson Nano developer kit and developed my code based off the JetsonHacks VL53L0X library and Pololu VL6180X library. After I was able to successfully read measurement inputs from the sensor I encountered an issue where it could only read a measurement of 135mm. Regardless of if I had an object over the sensor or nothing at all a measurement of 135mm was read in.

My belief is that I’m making mistakes in writing and reading to the sensors registers, however, I can’t quite seem to grasp the i2c_smbus_write/read functions to troubleshoot the issue.

I’ve uploaded the code to a github repo here
If you have any experience in using i2c and sensors on the Jetson Nano please feel free to help out, any advice will be greatly appreciated.

Update: I’ve realized that the issue with consistently reading a range val of 135mm from the result_range_val register is not the only issue. I’ve tried reading outputs from other registers and found that they all return 135, therefore, I’m not sure if the issue is only in me incorrectly reading/writing to the registers.

Does i2c tools like i2cget get the same value for each REG?