cancel
Showing results for 
Search instead for 
Did you mean: 

I2C communication problem with the VL53L1X Time of Flight sensor

frank1
Associate II

Hello,

I'm trying to use the VL53L1X on my nRF52DK, but I experience some problems.

Previously, I've successfully used the VL53L1X with an Arduino UNO using the pololu Arduino library (link below). For my project I need to use this sensor on the nRF52, so I've rewritten the vl53l1_platform.cpp and main .ino code to C (the other files are from ST's VL53L1 API, which are already in C).

When the sensor is not connected, the nRF52 is writing the correct data to the SCL and SDA lines, but if I connect the sensor, these lines give incorrect data. Instead of sending to address 0x29, it sends to address 0x7F or 0x00. And instead of sending the data 0x01 and 0x0F, it sends 0xFF and 0xFF (or 0x00 and 0x00).

I have correctly connected and initialized the INT and XSHUT lines.

I'm not sure what the problem can be, because it worked with the Arduino UNO, but not with the nRF52 (even though the I2C is working correctly without the sensor).

My setup:

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

here is some code that will prove your I2C is working correctly.

Put this in just after powerup and it will send and get bytes, words, longwords and strings.

Hopefully it will help.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

View solution in original post

2 REPLIES 2
John E KVAM
ST Employee

here is some code that will prove your I2C is working correctly.

Put this in just after powerup and it will send and get bytes, words, longwords and strings.

Hopefully it will help.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
frank1
Associate II

Thank you for the reply and verification code. I got it to work now.

I changed the sensor for a new one, and I your verification code showed that this new sensor is working correctly (so probably the first sensor got broken somehow)