2020-01-22 04:10 AM
In our application, we have two modes. In first mode, proximity is in interrupt mode and host is in standby. When user defined threshold is met (distance of object to proximity sensor is below certain distance) interrupt is raised. Now host processes this interrupt and disables interrupts from proximity. Proximity is now in polling mode. From this point on host, when needed, polls measurements to find out how far object is from proximity. No interrupts should occur at this point.
This use case is possible to achieve with VL53L0X sensor, by stopping measurement, changing config, and starting measurement again. But VL53L0X has too short range for our application. I am wondering if similar flow can be achieved with VL53L1, which has a longer range.
From what I can tell from documentation, when measurement is ready (and meets thresholds) physical interrupt is always raised on GPIO1 pin. What we want is to get measurement by polling but without physical interrupt happening. One idea was to change threshold, but it seems that even polling measurements are not available if threshold is not met. I'm not sure why interrupt and measurements are so coupled together on VL53L1.
Is there any way achieve this with VL53L1 sensor.
2020-01-27 06:21 AM
Hi EVuša.1,
I understand your requirement and agree that such use case should be handled. Let me check the code and come back to you with a correct answer.
Thanks,
Julien
2020-02-04 07:39 AM
Sorry for the slow answer. It's not a question that we've encountered before.
I'm thinking it's not the interrupt that's the issue, but what you do when the interrupt pin fires.
Can you not decide to ignore the interrupt in your system?
Or even if your interrupt routine gets triggered just do nothing when you are in the polling mode?
Might you consider having your interrupt routine act in one way when looking for a near target? And acting in a different way when in you 'poling mode'?
I'm going to pass this one to see if anyone else has an opinion.
2020-02-06 12:50 AM
Hi,
Thank you for answer. From what we were able to find there is no easy way to tell our system to ignore interrupts. Then we tried making interrupt handling routine do nothing when interrupt happens but this has also resulted with low performance because of the often routine calls.
2020-02-06 07:53 AM
how about this...
When you no longer want interrupts, set the threshold to something ridiculously short - say 15cm, or 5.
that will reduce the number of interrupts if not eliminate them completely.
When you are ready, move the threshold back to the old position.
You might even try changing the threshold without stopping the sensor. I think that works, although I've never tried it.
I've never tried to range without getting an interrupt - finding easy to simply ignore the interrupt - but I suspect you are right.
2020-02-06 08:42 AM
Thank you for your answer, John.
That was one of the ideas that I wanted to try, but I wasn't able to get values by polling that are outside of the set threshold.
This is because function `VL53L1_WaitMeasurementDataReady` waits for interrupt to be raised. \
So VL53L1_WaitMeasurementDataReady calls VL53L1_poll_for_range_completion which then "polls bit 0 of VL53L1_GPIO__TIO_HV_STATUS to determine the state of output interrupt pin".
2020-02-06 09:04 AM
Ouch. The 'done' bit and the interrupt are tied together. I think I knew that but never considered the implication.
Looks like your only choice is to disable the interrupt bit on your host.
Sorry about that.