cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L3CX distance offset drifts across power cycles

m864cdf4ac
Associate II

Hello,

in one of our new devices, we are using the VL53L3CX as a distance sensor, mainly for its small size and I2C connectivity. But we found out that even if we compensate the distance offset, after turning the device off and on again, the compensation is not valid anymore. The variance is in order of millimeters, but sometimes we can get up to 10 mm of difference. The API offset functions just add/subtract value internally. We tested it with the small daughter boards of the X-NUCLEO-53L3A2 and later with own PCBs. Is there a way how to get the distance consistent across power cycles?

 

1 REPLY 1
John E KVAM
ST Employee

Sorry for the slow response. This was a tricky one and I'm not completely sure this will fix it. 

But in the API there is a function:

L53LX_Error VL53LX_load_patch(VL53LX_DEV Dev)
{
	VL53LX_Error status = VL53LX_ERROR_NONE;
	int32_t patch_tuning = 0;
	uint8_t comms_buffer[256];
	uint32_t patch_power;

	LOG_FUNCTION_START("");

	if (status == VL53LX_ERROR_NONE)
		status = VL53LX_WrByte(Dev,
		VL53LX_FIRMWARE__ENABLE, 0x00);

	if (status == VL53LX_ERROR_NONE)
		VL53LX_enable_powerforce(Dev);

	VL53LX_get_tuning_parm(Dev, VL53LX_TUNINGPARM_PHASECAL_PATCH_POWER,
			&patch_tuning);

	switch (patch_tuning) {
	case 0:
		patch_power = 0x00;
		break;
	case 1:
		patch_power = 0x10;
		break;
	case 2:
		patch_power = 0x20;
		break;
	case 3:
		patch_power = 0x40;
		break;

It gets called by start-measurement. 

The trick is to ensure Case 3 is called. 

This will spend a lot more time trying to adjust the phase locked loop prior to beginning the run. It means a bit more latency at the start of ranging, but it should improve the variability. 

The reason the patch is loaded at the start and unloaded at the stop is to save power. Keeping the patch memory alive takes quite a bit of power. 

- 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.