Skip to main content
Associate
March 3, 2025
Question

Need help configuring VL53L8 firmware

  • March 3, 2025
  • 2 replies
  • 788 views

Hello,

I’m working on a project where I have a Nucleo F401RE connected to a 53L8A1 expansion board. I’m able to get the histogram plot with the ToF sensor on the expansion board but am wondering if I will still be able to get it if I use an external trigger with a VL53L8 ToF sensor attached to the expansion board. If anyone knows if this is possible or has done it before, input would be greatly appreciated.
P.S. I am also using STM’s custom project, CUSTOM/VL53L8CX_SimpleRanging and I am using the histogram functionality with Example_12_cnh_data.c from their VL53LMZ_ULD folder.

Thank you!

2 replies

John E KVAM
ST Employee
March 4, 2025

I'm not exactly sure what you mean by external trigger. By default, the sensor runs as often as you specify up to 15 frames per second and you get an interrupt whenever the sensor completes. Or you can set up thresholds and interrupt on changes in distance or signal strength. (Up to 64 different conditions can be specified.)

But here is where you lose me. External trigger. Does that mean you want some other event to start the sensor? I'm not sure how you could do that. 

Or is the trigger something crossing a threshold. in which case you will get the interrupt and can read the data. 

- john

ay0and0Author
Associate
March 11, 2025

By trigger I meant using the external synchronization pin. Like in section 4.15 of the following pdf manual, https://www.st.com/resource/en/user_manual/um3183-a-guide-for-using-the-artificial-intelligence-enabler-vl53l7ch-and-vl53l8ch-multizone-timeofflight-tof-sensors-stmicroelectronics.pdf . 

With the external synchronization pin, can I control the histogram or the frame acquisition, I would like to know what I can control the sensor with the external synchronization pin.

Are there any example codes or templates utilizing the external synchronization pin?

John E KVAM
ST Employee
March 11, 2025

In my code I see:

#ifdef SYNC_PIN_TEST
	vl53l8cx_set_external_sync_pin_enable(&Dev, 1);
	if(status){
		printf("ERROR - vl53l8cx_set_external_sync_pin_enable : %d\n", status);
		while(1);
	}
#endif

and

#ifdef SYNC_PIN_TEST
	toggle_gpio2();
#endif
#ifdef SYNC_PIN_TEST
			printf("Sleep for 3 second\n");
			HAL_Delay(3000);
			toggle_gpio2();
#endif

 

But what I'm assuming you want is how to set up the GPIO, and of course I only do this on STM32's because that's where I work. 

and that code looks like this:

uint8_t vl53l8cx_set_external_sync_pin_enable(
		VL53L8CX_Configuration		*p_dev,
		uint8_t				enable_sync_pin)
{
	uint8_t status = VL53L8CX_STATUS_OK;
 uint32_t tmp;

	status |= vl53l8cx_dci_read_data(p_dev, p_dev->temp_buffer,
			VL53L8CX_DCI_SYNC_PIN, 4);
 tmp = (uint32_t)p_dev->temp_buffer[3];

	/* Update bit 1 with mask (set sync pause bit) */
	if(enable_sync_pin == (uint8_t)0)
	{
 tmp &= ~(1UL << 1);

	}
	else
	{
 tmp |= 1UL << 1;
	}

 p_dev->temp_buffer[3] = (uint8_t)tmp;
	status |= vl53l8cx_dci_write_data(p_dev, p_dev->temp_buffer,
			VL53L8CX_DCI_SYNC_PIN, 4);

	return status;
}
ay0and0Author
Associate
April 15, 2025

ay0and0_0-1744736551061.png

Where or what file do you see these lines of code at?

I am trying to get the external synchronization pin to be enabled, so that my VL53L8CX senor starts reading as soon as I turn that outside trigger on.