cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the VL53L8CH to get data with 64 zones with 18 bins at 15 Hz?

Licx
Associate III

Currently I connected the X-NUCLEO-53L8A1 to F401RE, and I notice that on the web page of VL53L8CH, the sensor can get the data with 64 zones with 18 bins at 15 Hz. But when I use the VL53L8CH with the Example_12_cnh_data which use VL53LMZ_ULD_API, I found that when I set the cnh config to get the data with 64 resolution, 16 bins, and 15Hz, the fps I get from the serial port is only 3.6Hz, not 15Hz. Is there any way to improve the FPS of the code?

1 ACCEPTED SOLUTION

Accepted Solutions
Anne BIGOT
ST Employee

The example code is only meant to be an example of how to configure and decode data.  Nothing in the code is optimised for speed.

 

Data size of the CNH data for 8 x 8 x 18bins is about 6KB   => best case about 60ms at 1000KHz I2C.

 

Sending data to host, via USART-USB link takes considerable time (921.6KHz baud rate)

 

In Example_12_cnh_data you can try commenting out all the printf() statements except the one that prints out the streamcount.   Then you will see what rate you can get data from the sensor ignoring the extra time it takes to send the data to the host.

 

To achieve higher frame rates you can use DMA to allow you to read data from VL53L8CH via I2C while concurrently sending data to the host via the USART-USB.

 

The STM32 firmware that is used with the MZAI EVK GUI project uses this approach with the data to be sent to the host being buffered before being sent to the host as a single block via DMA transfer.  With this method 10fps is achieved, with the limiting factor being the time it takes to send data to the PC host.

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

12 REPLIES 12
Upasana
Associate

Hey, I know this is not related to your problem but I was wondering if you could share the pinout config you used? since I am also using the same components.

I used X-NUCLEO-53L8A1, and connected it to F401RE. After that I used CubeIDE_F401RE_Example directly, which can be found in STSW-IMG043_ULD(https://www.st.com/en/embedded-software/stsw-img043.html). This Example can be used to view pin settings in cubeide.

Hello

Your question regarding the FPS have been reached internally.
Please accept some delay in the response as Christmas time i coming.
Regards


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
John E KVAM
ST Employee

One might suggest it's not the sensor that's the limiting factor, but your MCU. Are you using a 1MHz I2C? Are you doing anything with the data that takes time? The sensor is not the limit here, but the IO bandwidth and doing something with the data. I'd look there. 

- john


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.
Anne BIGOT
ST Employee

The example code is only meant to be an example of how to configure and decode data.  Nothing in the code is optimised for speed.

 

Data size of the CNH data for 8 x 8 x 18bins is about 6KB   => best case about 60ms at 1000KHz I2C.

 

Sending data to host, via USART-USB link takes considerable time (921.6KHz baud rate)

 

In Example_12_cnh_data you can try commenting out all the printf() statements except the one that prints out the streamcount.   Then you will see what rate you can get data from the sensor ignoring the extra time it takes to send the data to the host.

 

To achieve higher frame rates you can use DMA to allow you to read data from VL53L8CH via I2C while concurrently sending data to the host via the USART-USB.

 

The STM32 firmware that is used with the MZAI EVK GUI project uses this approach with the data to be sent to the host being buffered before being sent to the host as a single block via DMA transfer.  With this method 10fps is achieved, with the limiting factor being the time it takes to send data to the PC host.

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for your reply, currently I am using F401RE and use the code based on Example_12_cnh_data derectly.

Thanks for your reply, I will try the solution that you mentioned.

Hi, currently I can use the dma through ef_add_int32 and ef_add_int8 function to transmit the data to my computer, but I don’t know how to decode it. Is there any good method to decode the data? The function is shown below:

void ef_add_int8( int8_t data ) {

 

if ( (g_curr_pos + sizeof(uint8_t) + 1 + sizeof(g_suffix)) > EF_BUFFER_SIZE ) /* overhead includes CRC byte */

g_error_detected = true;

 

if ( g_error_detected )

return;

 

g_frame[g_curr_pos++]=data;

 

return;

};

 

And the data I get looks like:

Licx_0-1703153065716.png

The above data are getting from the printf and the data on the buttom is the data from DMA

 

 

Licx
Associate III

I readed the data  and decoded the data based on dma method, but currently when I send the 64 depths and 64*16 bin data to my computer, the fps is 7.5