Skip to main content
BBald.1
Associate II
September 30, 2021
Solved

Detection thresholds confusion

  • September 30, 2021
  • 3 replies
  • 1280 views

A couple of questions.

First there seems to be some conflicting comments. In the vl53l5cx_plugin_detection_thresholds.h file there is the following statement in regard to the mathematical operators for multiple checkers. "Please note that the first checker MUST always be a OR operation." Then in the file Example_9_detection_thresholds.c there is the statement " Please note that the first one must always be set with a mathematic_operation VL53L5CX_OPERATION_NONE." I've tried the example with both OR and NONE and it works either way.

The seconds question is I can't seem to get the AND operation to work. I want it trigger when the distance is between 200 and 400 mm AND the SIGNAL_PER_SPAD_KCPS > 10. When I use the VL53L5CX_OPERATION_AND operator it never triggers. If I change it to look for VL53L5CX_TARGET_STATUS == 5 instead of VL53L5CX_SIGNAL_PER_SPAD_KCPS > 10 then it triggers, but none of the zones have a distance between 200 and 400 mm. Looks like it is triggering when the distance is between 50 and 100 mm AND status == 5.

Thank you

This topic has been closed for replies.
Best answer by Thomas.PEROTTO

Hi John, BBald.1,

We just committed the driver version 1.1.2 on ST.com with this patch.

Thanks for finding and correcting this issue.

Regards,

Thomas

3 replies

John E KVAM
ST Employee
October 11, 2021

if you look at the definition of the VL53L5CX_OPERATION_NONE and the OR, you will find they are both defined as Zero.

But you have a point about the documentation.

And we believe you have found a legitimate bug in the AND condition software.

We are trying to track that down.

I'll repost when a solution is published.

(Turns out this is proving to be a bit tricky.)

  • john
John E KVAM
ST Employee
October 11, 2021

I think we found the problem...

It seems this is a pointer bug in ULD. Can you please review my test change that I verified:

File name: vl53l5cx_plugin_detection_thresholds.c

Function name: vl53l5cx_set_detection_thresholds()

Line 168 :

change from

switch(p_thresholds->measurement)

to

switch(p_thresholds[i].measurement) 

in this section of code we are scaling the input parameter to the format required by the chip.

and by using a pointer (and not incrementing it) we applied the wrong scaling factor to all the interrupt checkers.

  • john
BBald.1
BBald.1Author
Associate II
October 12, 2021

John,

That seems to have got it. The AND is now working.

Thanks!

Barry

Thomas.PEROTTO
Thomas.PEROTTOBest answer
ST Employee
October 13, 2021

Hi John, BBald.1,

We just committed the driver version 1.1.2 on ST.com with this patch.

Thanks for finding and correcting this issue.

Regards,

Thomas