2025-02-23 8:09 PM
I'm extracting the histogram data from the VL53L8CH. In the 8x8 mode, we are limited to few bins (~18) per reading. Is there a way to configure the sensor to oscillate the starting bin configuration so that I can get better range with the same bin precision? For example, in a cycle read bins 0-17, then bin 18-35, etc. If this is possible, is there guidance for how this can be done? Following the code from Example_12_cnh_data.c, is it possible to setup multiple configurations within a loop, such as vl53lmz_cnh_init_config(&cnh_config, 0, 18, 1), vl53lmz_cnh_init_config(&cnh_config, 18, 18, 1), etc?
Solved! Go to Solution.
2025-03-07 2:07 AM
WSUN,
What you want to do, a sequence of different configurations, is not a feature we have.
However, it should be possible to dynamically change some CNH parameter settings while the sensor is ranging.
Some parameters are only read when the ranging starts, specifically parameters which define the memory layout of the CNH data passed back to the host, and as such these can't be changed while ranging.
But, since the StartBin parameter does not affect the memory layout it should be possible to change while ranging.
With reference to the code in the vl53lmz_plugin_cnh.c file:
-- It should be enough to modify the ref_bin_offset field of the VL53LMZ_Motion_Configuration structure based on the new StartBin value required and then resending this to the device with the function vl53lmz_cnh_send_config()
BUT...you must be aware that the new value will be used immediately, there is no syncronisation mechanism to ensure the new value gets applied at the start of the next frame, so you may receive a frame of CNH data in which the setting changes part way through the data.
So the safest policy will be to write the change, discard one frame of data, then take the second frame of data after change was written.
Hope this helps.
Roger
2025-03-07 2:07 AM
WSUN,
What you want to do, a sequence of different configurations, is not a feature we have.
However, it should be possible to dynamically change some CNH parameter settings while the sensor is ranging.
Some parameters are only read when the ranging starts, specifically parameters which define the memory layout of the CNH data passed back to the host, and as such these can't be changed while ranging.
But, since the StartBin parameter does not affect the memory layout it should be possible to change while ranging.
With reference to the code in the vl53lmz_plugin_cnh.c file:
-- It should be enough to modify the ref_bin_offset field of the VL53LMZ_Motion_Configuration structure based on the new StartBin value required and then resending this to the device with the function vl53lmz_cnh_send_config()
BUT...you must be aware that the new value will be used immediately, there is no syncronisation mechanism to ensure the new value gets applied at the start of the next frame, so you may receive a frame of CNH data in which the setting changes part way through the data.
So the safest policy will be to write the change, discard one frame of data, then take the second frame of data after change was written.
Hope this helps.
Roger
2025-03-12 1:47 PM
Thank you, this works. However just for reference, it seems that the update only synchronizes consistently after throwing away two (or more) full frames of data.