cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X and VL53L4CD detection

will3
Associate III

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

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.

View solution in original post

2 REPLIES 2
John E KVAM
ST Employee

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.

Perfect! Thank you!