cancel
Showing results for 
Search instead for 
Did you mean: 

VL53l0X / i2c problem, need some help understanding the protocol to read distance information

Aharon1
Associate II

VL53l0X / i2c problem

Trying to use I2C to read vl53l0x, I fail to understand from the datasheet :

1. what exactly are the indexes and what indexes I'm suppose to use when reading,

2. Also how many bytes include in one data sample ?

From the data sheet I see that in order to read I have to transmit the following 

address - 0x52 (or c)

index (this is unclear to me)

address - 0x52 (or 0x29 + 0x01 in my case since Im using Adafruit VL53L0X breakout)

data [0:7] - does 1 byte represents one read ?

Basically I need more clarifications regarding the i2c protocol

Thanks !

links:

VL53L0X datasheet

https://www.st.com/resource/en/datasheet/vl53l0x.pdf

VL53L0X Adafruit beakout

https://cdn-learn.adafruit.com/downloads/pdf/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout.pdf

I'm using Discovery kit with STM32F303VC MCU to interface the sensor

4 REPLIES 4
S.Ma
Principal

I'm trying to integrate VL53L1X on a custom board which has various sensors (intertial and optical) from various vendors.

As I'm integrating (adding) VL53L1X, I prefered to use generic SW package (STSW-IMG007)

I add API/CORE and API/PLATFORM to my project C file main folder, and added the subfolder to the project compiler preprocessor path (to be able to find the files)

The good thing is that MCU, Peripheral and board specifics are to be user implemeted in shell empty functions.

It does not give hints in the I2C bus if a 32 bit shall be MSB or LSB first (even as commented code).

So I unzipped the code for the nucleo with STM32L4 and grabbed the platform.c file.

There as you know that ARM stores LSB first (low address), you can get the missing dots which don't show up in the datasheet.

There is 0x52/0x53 slave address (I sweep all possible slaves in my init code) for this chip.

Commands are byte blocks write, byte blocks read, us and ms delays to implement. (not using interrupt).

Compared to a device like LV0104 or VEML6070, this I2C slave sensor is much different to integrate, while all these are optical sensors....

I'm now compile/link ok with functions called from main. Debug start this week 4 me.

Aharon1
Associate II

Thank you,

I have downloaded STSW-IMG005 for VL53L0X and started trying to integrate it into the code

The first problem I encountered was that he expects inclusion of #include <Windows.h>,

Any idea where can I find that ? is this suppose to work with STM23F303 ?

Thanks !

Hi, were you able to find the windows.h file? I am currently trying to integrate the VL53L0x with an STM32F3, but I can't seem to get the API working (in KEIL) because of missing header files. I suspect we are struggling with the same issue.

No, I just opted to use STM32F401RE Nucleo which has ready examples to deal with the sensor