cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L01 optical center register setting

baev_al
Associate II

Hi.

Please help me with VL53l1.

1)     Is it possible to read distance from individual pixel or is it only some kind of interpolation of the 4 x 4 region?

2)     Is there a description of registers which should be modified (and how they should be modified) to set size and coordinates of ROI (or pixel if it is possible)? I managed to run en.STSW-IMG009, however it doesn’t have the above function (it is possible to set size only, but not coordinates). I tried to run en.STSW-IMG007 and failed.

Light lib has the following function:

VL53L1X_ERROR VL53L1X_SetROI(VL53L1_Dev_t dev, uint16_t X, uint16_t Y)
{
	uint8_t OpticalCenter;
	VL53L1X_ERROR status = 0;
 
	status =VL53L1_RdByte(&dev, VL53L1_ROI_CONFIG__MODE_ROI_CENTRE_SPAD, &OpticalCenter);
	if (X > 16)
		X = 16;
	if (Y > 16)
		Y = 16;
	if (X > 10 || Y > 10){
		OpticalCenter = 199;
	}
	status = VL53L1_WrByte(&dev, ROI_CONFIG__USER_ROI_CENTRE_SPAD, OpticalCenter);
	status = VL53L1_WrByte(&dev, ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE,
		       (Y - 1) << 4 | (X - 1));
	return status;
}

What is the OpticalCenter and how can I calculate it?

Thanks.

4 REPLIES 4
John E KVAM
ST Employee

​Use the SW-IMG009.

Go to

https://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl53l1x.html#resource

And download App note

AN5191  Using the programmable region of interest (ROI) with the VL53L1.

the smallest region you can read is a 4x4.

The optical center is found and placed into non-volatile memory at manufacture during calibration. There is a function to read it.

And it should be used if your region is smaller than 10x10, otherwise to have to use the actual center - which is #199. (otherwise your region might be outside the bounds of the SPAD array.

You might need to download a newer version of the Ultra Light Driver. We keep adding features.

but check out the app note. It's what you want.


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.

AN5191 suggests using of VL53L1_SetUserROI(). This is SW-IMG007 function. I just need the description of how to obtain data for ROI_CONFIG__USER_ROI_CENTRE_SPAD and ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE registers. Then I will need just to write two bytes...

Sorry, found it in the last version of the ULD. Thank you.

S.Ma
Principal

Look at en.STSW-IMG009 which is easier learning curve driver in fewer source file.