cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L4CD Interrupts

pthakkar
Visitor

Hi

I am using VL53L4CD for detecting presence of an object at a distance below 300mm. I have considered Examnple4 Ultra Low Power as the base. I am able to get the interrupts when an object comes below 300mm distance as expected.

But in this scenario if the object stays at a distance below 300mm I keep on getting the interrupts after a  regular interval.

What I want to implement is that I should get interrupt once an object comes below 300mm and once when it goes away. 

Is it possible to get this functionality?

2 REPLIES 2
John E KVAM
ST Employee

With the VL53L sensors each range is independent of any other range. So, indeed, you will get an interrupt every time you range if you have your thresholds and you have an object lower than your threshold. 

If you want to trigger exactly once when the object comes near and get another interrupt when the object goes away, you should get the interrupt, reconfigure your interrupts for above your threshold. Once the object has gone away, you can go back to your 'below' threshold configuration. 

In order to make this work right you might have to do a bit of a re-write on the interrupt section. 

We simplified that code a bit as 99% of our customers don't need this functionality:

The register definition below 

SYSTEM__INTERRUPT_CONFIG_GPIO

 

7

6

5

4

3

2

1

0

RESERVED

int_mode

R

R/W

  •            reg_bank_go2_hostBaseAddress + 0x077
  •                     R/W
  •                    0x7
  •   

[2:0]

int_mode: Interrupt mode source for Range readings (single bit to set usage to either range or phase)

0: Disabled
1: Level Low (Range) (value < thresh_low)
2: Level High (Range) (value > thresh_high)
3: Out Of Window (Range) value < thresh_low OR value > thresh_high)
4: Level Low (Signal rate) (value < thresh_low)
5: Level High (Signal rate) (value > thresh_high)
6: Out Of Window (Signal rate) (value < thresh_low OR value > thresh_high)
7: New Sample Ready

Try playing with 'out of Window'. Make sure you get an interrupt when you object leaves the area.

But I honestly think you are going to do better, by detecting the interrupt, and assuming your object went away when you stop getting them. 

Good luck.

 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.
pthakkar
Visitor

Hi John

Actually in my application, the object will stay below the threshold for more than 12 hours in a day... So getting interrupts for such long duration is not desirable as it will be a battery operated device...

I tried looking for the register definitions in the data sheet but I could not find any descritions there.. Can you point me to the document where I can get these definitions...

I am not sure where in the code I need to make the changes suggested by you..

Regards

Parag