cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L0X - How to Interface VL53L0X with PIC18F57Q43?

anusuya
Associate

I interfaced VL53L0X with PIC18F57Q43 and managed to obtain the data, but the sensor requires a hard reset (manually removing the supply and reconnecting it) to obtain continues ranging data. I would like to know how I can obtain the data continuously?

1 REPLY 1
John E KVAM
ST Employee

There is an XShut line that you can drop and lift. This will completely reset the sensor.

You should not have reset the sensor.

Once you set it up and issue the start, the sensor should take off ranging until you tell it to stop.

It might be an issue with resetting the interrupt line. On the first range, the interrupt will trigger and it will stay that way until you issue the 'clear interrupt'.

Something like:

        for(measurement=0; measurement<no_of_measurements; measurement++)
        {
 
            Status = WaitMeasurementDataReady(pMyDevice);
 
            if(Status == VL53L0X_ERROR_NONE)
            {
                Status = VL53L0X_GetRangingMeasurementData(pMyDevice, pRangingMeasurementData);
 
                *(pResults + measurement) = pRangingMeasurementData->RangeMilliMeter;
                printf("In loop measurement %d: %d\n", measurement, pRangingMeasurementData->RangeMilliMeter);
 
                // Clear the interrupt
                VL53L0X_ClearInterruptMask(pMyDevice, VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY);
                VL53L0X_PollingDelay(pMyDevice);
            } else {
                break;
            }
        }

Could that be the issue?


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.