Skip to main content
Associate III
January 20, 2025
Solved

VL53L1X and VL53L4CD detection

  • January 20, 2025
  • 1 reply
  • 1072 views

We are beginning to migrate from the L1 to the L4. 

Wondering if there is a way to auto-detect which sensor is on the board? I would like to build one fw version which abstracts away which sensor is in use (albeit taking advantage of diff features) but all I see is SWVersion API which only returns version not type.  Both appear to be same address on I2C for us.

Thanks,

Will

 

Best answer by John E KVAM

Both those chips should have a model ID at the same location

#define VL53L4CD_IDENTIFICATION__MODEL_ID                            0x010F
and
#define VL53L1_IDENTIFICATION__MODEL_ID                     0x010F
 
VL53L1X_ERROR VL53L1X_GetSensorId(VL53L1_Dev_t dev, uint16_t *sensorId)
{
	VL53L1X_ERROR status = 0;
	uint16_t tmp = 0;

	status = VL53L1_RdWord(&dev, VL53L1_IDENTIFICATION__MODEL_ID, &tmp);
	*sensorId = tmp;
	return status;
}

I can't remember which one is which, but it should be easy enough to test. 

- john

1 reply

John E KVAM
ST Employee
January 20, 2025

Both those chips should have a model ID at the same location

#define VL53L4CD_IDENTIFICATION__MODEL_ID                            0x010F
and
#define VL53L1_IDENTIFICATION__MODEL_ID                     0x010F
 
VL53L1X_ERROR VL53L1X_GetSensorId(VL53L1_Dev_t dev, uint16_t *sensorId)
{
	VL53L1X_ERROR status = 0;
	uint16_t tmp = 0;

	status = VL53L1_RdWord(&dev, VL53L1_IDENTIFICATION__MODEL_ID, &tmp);
	*sensorId = tmp;
	return status;
}

I can't remember which one is which, but it should be easy enough to test. 

- john

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.
will3Author
Associate III
January 20, 2025

Perfect! Thank you!