cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1 Breakout Boards changes their L2C addresses after Init() and doesn't measure / communicate.

ritzeng
Associate II

Environment: Arduino, STM32F1, ESP32

I2CScanner told me a device has the address #29

Your default address in the sample code is #12

Software: VL53L1_Sat_Helloworld Example

changes: 

  • DEV_I2C.begin(23, 22); // I2C 1: SDA, SCL
  •   sensor_vl53l1_sat.InitSensor(0x29);
  • VL53L1 sensor_vl53l1_sat(&DEV_I2C, 5); // XSHUT pin

The do - while loop never will be finished, resp. the LED will never switched on.

The I tested the code with a lot of I2C address scans; start with 29 and in the while loop the I2C code is #09 #0A #14, depending on the start.

I have added a BME280 Sensor, which is absolute stable

I dropped the Clock frequency to 100kHz.

I tested all with ESP32 and STM32F1 Bluepill. Both CPU platforms must be supported in the future.

I tested all already with the VL53L1X, and an adaption its Setup and loop, which worked immediately.

I took the pure chip and solder it onto header and checked it. No result. I'havent stepped into the software driver much. I thought the samples must run first (as all my past sensors are working).

Where can the problem be with this specific sensor?

Thank you

Frank H. Ritz

Below the relevant code part.

#include <Arduino.h>

#include <Wire.h>

#include <vl53l1_class.h>

#include <string.h>

#include <stdlib.h>

#include <stdio.h>

#include <stdint.h>

#include <assert.h>

#include <stdlib.h>

#define DEV_I2C Wire

#define SerialPort Serial

#ifndef LED_BUILTIN

#define LED_BUILTIN 13

#endif

#define LedPin LED_BUILTIN

// Components.

VL53L1 sensor_vl53l1_sat(&DEV_I2C, 5); // A1 for STM32F1

/* Setup ---------------------------------------------------------------------*/

void setup()

{

  // Led.

  pinMode(LedPin, OUTPUT);

  // Initialize serial for output.

  SerialPort.begin(115200);

  SerialPort.println("Starting...");

  // Initialize I2C bus.

  DEV_I2C.begin(22,23); // DEV_I2C.begin(); for STM32F1

  // Configure VL53L1 satellite component.

  sensor_vl53l1_sat.begin();

  // Switch off VL53L1 satellite component.

  sensor_vl53l1_sat.VL53L1_Off();

  //Initialize VL53L1 satellite component.

  sensor_vl53l1_sat.InitSensor(0x29);

  // Start Measurements

  sensor_vl53l1_sat.VL53L1_SetPresetMode(VL53L1_PRESETMODE_RANGING);

  sensor_vl53l1_sat.VL53L1_StartMeasurement();

}

void loop()

{

  VL53L1_MultiRangingData_t MultiRangingData;

  VL53L1_MultiRangingData_t *pMultiRangingData = &MultiRangingData;

  uint8_t NewDataReady = 0;

  int no_of_object_found = 0, j;

  char report[64];

  int status;

  do

  {

   status = sensor_vl53l1_sat.VL53L1_GetMeasurementDataReady(&NewDataReady);

  } while (!NewDataReady);

  //Led on

  digitalWrite(LedPin, HIGH);

...

...

...

}

4 REPLIES 4
ritzeng
Associate II

Here a picture with the ESP32.

ritzeng
Associate II

Fixed, but there is some inconsistency, it seems that there are some activities still open, when the scanner reads the bus.

ACher.4
Associate II

Hello, Did you find out what the problem was?

ritzeng
Associate II

I solved the problem. The provided examples software for Arduino Environment's never worked. I will publish my example and the working solution at my GitHub the next days here. It's running on ESP 8266 and ESP32 and STM platforms.

Thank you very much.

Frank