cancel
Showing results for 
Search instead for 
Did you mean: 

Moving from VL53L1CB to VL53L1X ULD API

nico23
Associate III

I'm using the full API for the VL53L1 ToF sensor. The project is pretty simple as I'm using 4 sensor to measure distance connected on an I2C of an STM32F091.

I'm optimizing the code and I'm come across the VL53L1X ULD API (Ultra Lite Driver Application Programming Interface) STSW-IMG009.

From what I'm seeing most of the function I'm using:

  • VL53L1_StartMeasurement
  • VL53L1_GetMeasurementDataReady
  • VL53L1_GetRangingMeasurementData
  • VL53L1_ClearInterruptAndStartMeasurement
  • XNUCLEO53L1A1_ResetId
  • VL53L1_SetDeviceAddress
  • VL53L1_WaitDeviceBooted
  • VL53L1_DataInit
  • VL53L1_StaticInit
  • VL53L1_SetDistanceMode
  • VL53L1_SetMeasurementTimingBudgetMicroSeconds
  • VL53L1_SetInterMeasurementPeriodMilliSeconds

Could be replaced with the ones available in the ULD API.

The only thing I can't understand is how to edit the Dev structure. I'm currently using

Dev->I2cHandle = &hi2c2;
Dev->comms_speed_khz = 100; //400
Dev->comms_type = 1;
Dev->I2cDevAddr = 0x52; // default ToF sensor I2C address

From what I'm understanding I have to edit VL51L1X_NVM_CONFIGURATION and VL51L1X_DEFAULT_CONFIGURATION with the settings I'm using.

Is that right?

1 REPLY 1
John E KVAM
ST Employee

When I set down the rules for the ULD driver, I specified absolute simplicity. No hiding of classes, no layers to hide behind, and dead simple code. 

Someone decided to eliminate all structures as well. INCLUDNG the 'dev' structure. 

Change that structure to an 'int'. Make the 'int' equal to the I2C address of your sensor. 

So uint16_t dev=0x52; by default, should do it. 

uint16_t dev=0x52;

But you should see an example of this.

Downloaded the latest from STSW-IMG009 - VL53L1X ULD API (Ultra Lite Driver Application Programming Interface) - STMicroelectronics

We are at version 3.5.4. 


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.