Skip to main content
frank1
Associate II
May 19, 2021
Solved

I2C communication problem with the VL53L1X Time of Flight sensor

  • May 19, 2021
  • 2 replies
  • 2357 views

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:

This topic has been closed for replies.
Best answer by John E KVAM

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

2 replies

John E KVAM
John E KVAMBest answer
ST Employee
May 19, 2021

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
frank1
frank1Author
Associate II
May 20, 2021

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)