Skip to main content
Senior III
August 7, 2025
Question

VL53L1X_SensorInit has an infinite loop that hangs the sensor

  • August 7, 2025
  • 1 reply
  • 275 views

The STSW-IMG009 VL53L1X ULD API (Ultra Lite Driver Application Programming Interface) has a bug in the function VL53L1X_SensorInit that blocks the code from being executed if  status |= VL53L1X_CheckForDataReady(dev, &tmp);  write 0 constantly in tmp

The block 

	while (tmp == 0) {
		status |= VL53L1X_CheckForDataReady(dev, &tmp);
	}

has no timeout implemented and, for instance, if a cable or a sensor breaks for some reason, the code will endup stuck there

Please also see this github issue exit VL53L1X_SensorInit() after timeout if no sensor / sensor doesn't work · Issue #29 · sparkfun/SparkFun_VL53L1X_Arduino_Library

where a timeout is added Add timeout to sensorInit · sparkfun/qwiic_vl53l1x_py@1154d07 · GitHub

1 reply

Anne BIGOT
Technical Moderator
August 14, 2025

Hello,
Your feedback has been transferred internally to the software team.
We will update you on this specific topic.

Anne

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised. ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'