cancel
Showing results for 
Search instead for 
Did you mean: 

VL6180X Issues Interfacing with TI MSP432P401R Microcontroller

PTran.9
Associate

Hi all,

I am trying to get the VL6180X to work with my TI MSP432P401R Microcontroller. I purchased my VL6180X on a breakout board manufactured by Adafruit (https://www.adafruit.com/product/3316). I have gotten it working with an Arduino just to verify that the sensor is functional, and I am using the libraries created by Adafruit specifically for the VL6180X sensor (https://github.com/adafruit/Adafruit_VL6180X).

However, when I try to use it with my TI microcontroller, it stops working. On my TI microcontroller, I have essentially copied the Adafruit Arduino code and modified it slightly so that it can work with the TI microcontroller. The I2C read function works fine, and I am able to confirm this by reading the device ID from register 0x0000. I am checking the RESULT_RANGE_STATUS register (0x04D) before I start a range measurement, and I am getting a register value of decimal 25, which would be binary 00011001. According to the VL6180X datasheet, this means that I am encountering a VCSEL Continuity Test error. The VL6180X error codes explanation document says that if I encounter this error, I should reset the device and if the issue continues, I should stop using the device. I have tried resetting the device by writing to the mandatory private and optional public registers as found in the vl6180x_api.c file that I downloaded from the STM website. However, this does not resolve the problem. I have even tried running the sensor first on the Arduino, which resets the sensor, and then connecting it to my TI microcontroller. This still produces the same VCSEL Continuity Test error, and I am not sure what to do. Does anyone have any input?

1 REPLY 1
John E KVAM
ST Employee

Every time I have gone wrong, it has to do with the I2C byte-swap. If it works on one MCU and not on the other, the first thing I would carefully examine is the endianness of your device. As the chip ID is one byte you can get that to work, and still have trouble transmitting words and longwords.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.