cancel
Showing results for 
Search instead for 
Did you mean: 

How to operate VL53L7CX ToF in 64 zones.

JSP
Associate II

Hi.

Regarding the VL53L7CX, I downloaded STSW-IMG036 (API Source) from the product page and tried running the Nucleo board and sensor using the example project included there. However, the default sensor operation setting in the code is 16(4×4) zones, but I don’t know exactly how to change it to 64(8×8) zones.
In the user manual
They say it can be changed in vl53l7cx_set_resolution(), but there is no detailed explanation, so it is currently not possible to modify it. It may be because I don't know C language well, but please help me with a detailed explanation.

STSW-IMG036

https://www.st.com/en/embedded-software/stsw-img036.html

1 ACCEPTED SOLUTION

Accepted Solutions
kwc
Associate III

It seems like you should be able to just insert a line to call the function like this, immediately after vl53l7cx_init():

	printf("Sensor initializing, please wait few seconds\n");
	status = vl53l7cx_init(&Dev);
	status = vl53l7cx_set_resolution(&Dev, VL53L7CX_RESOLUTION_8X8);
	status = vl53l7cx_set_ranging_frequency_hz(&Dev, 2);				// Set 2Hz ranging frequency
	status = vl53l7cx_set_ranging_mode(&Dev, VL53L7CX_RANGING_MODE_CONTINUOUS);  // Set mode continuous

If you still have trouble, hopefully someone else can offer more help as unfortunately I'm not very familiar with the Nucleo.

View solution in original post

4 REPLIES 4
kwc
Associate III

Have you looked at Example_2_get_set_params.c from the API? That example sets the resolution to 8x8.

JSP
Associate II
First of all, thank you for your opinion.
you're right. From the example code in the material, I was able to see that it operates in 8×8 mode. 
However, I am not yet skilled enough to know exactly how to use this code on the Nucleo board.
I tried to combine the example project and the example code, but it wasn't easy.
Is there a way to change the example project in the 'CubeIDE_F401RE_Example' folder to 8×8 mode by changing parameter values?

 

kwc
Associate III

It seems like you should be able to just insert a line to call the function like this, immediately after vl53l7cx_init():

	printf("Sensor initializing, please wait few seconds\n");
	status = vl53l7cx_init(&Dev);
	status = vl53l7cx_set_resolution(&Dev, VL53L7CX_RESOLUTION_8X8);
	status = vl53l7cx_set_ranging_frequency_hz(&Dev, 2);				// Set 2Hz ranging frequency
	status = vl53l7cx_set_ranging_mode(&Dev, VL53L7CX_RANGING_MODE_CONTINUOUS);  // Set mode continuous

If you still have trouble, hopefully someone else can offer more help as unfortunately I'm not very familiar with the Nucleo.

JSP
Associate II

Wow, thank you so much. I modified it as you suggested and it works perfectly.