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.
Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised. ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'