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?


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'