cancel
Showing results for 
Search instead for 
Did you mean: 

Detection thresholds confusion

BBald.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Thomas.PEROTTO
ST Employee

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

View solution in original post

4 REPLIES 4
John E KVAM
ST Employee

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

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
John E KVAM
ST Employee

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

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

John,

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

Thanks!

Barry

Thomas.PEROTTO
ST Employee

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