2018-09-05 03:32 AM
Hello,
We have integrated VL6180X proximity sensor with our Nordic chip. With help of ST application note we have prepared library for VL6180X sensor. We have consider all necessary setting mentioned in application note.
We are facing one strange issue. We are successfully getting range uptill 50mm but once object crosses 50mm it always show 255mm.
We tried many things like putting delay, changing I2C clock, switching to continuous mode but no luck till now.
I am attaching my VL6180X library and header file. Can anyone go through it and point out mistake if any.
Quick response will be highly appreciated.
Below is my Main.c file routine.
int main()
{
int range;
// load settings onto VL6180X
Init_Range_sensor();
Set_Default_Sensor_Data();
while (1)
{
twi_enable();
// start single range measurement
Start_Range_Sensor_Data();
// poll the VL6180X till new sample ready
Poll_Range_Sensor();
// read range result
range_mm = Read_Range();
printf("Range in mm = d\r\n",range_mm);
// clear the interrupt on VL6180X
Clear_VL6180_Sensor_Interrupt();
wait(0.1);
twi_disable();
}
}
2019-02-01 11:00 AM
Hi,
I have a similar issue. Did you manage to get it working?
Thanks.
2019-02-03 06:23 AM
I checked your code because I had a similar issue.
For me looking at the error code from register {0x04D} was helpful to see that every time the value jumped to 255, the error code was 0110: Early Convergence Estimate. When that happened measurement took only 6ms to make, whereas the valid measurement was always more than 10 ms.
You can tune the E2C but in my case I am not worried to power consumption, so I just disabled it - meaning it will try to get a valid measurement up to the max convergence time and not break after 5 ms if there is not enough signal by then. After I disabled the E2E I got valid measurements.
You are enabling it in your code by:
Write_Byte_VL6180(VL6180X_SYSRANGE_RANGE_CHECK_ENABLES, 0x10 | 0x01);
to disable it bit0 of this register should be zero and the hence:
Write_Byte_VL6180(VL6180X_SYSRANGE_RANGE_CHECK_ENABLES, 0x10);
This is the document which helped me understand E2E:
Thanks,
Igor
2019-04-08 04:19 PM
Exactly correct.
Any error status not equal to 0, will set the range to 255 (the largest number we can return).
So check the error code register to see why the sensor returned a 'fail'.
Keep in mind that there is a 'multiplier' to get distances above 255.
A multiplier of 2 will enable distances up to 510 mm, which is the practical upper limit.
2019-05-05 08:04 AM
For ranges 350mm+ I'd suggest using multiplier of 3, then you can measure even longer distances. Our tests show that we can measure up 580mm, even with a cover glass.