2018-02-21 05:47 AM
hi,
how does the Vl53L0X ranging sensor adress the GPIO for the interrupt, i can only find a long list of register adresses in the vl53l0x_interrupt_threshold_settings.h.
After initialization and calibration of the Sensor, i tried it with the code below. However, no interrupt is given out in StartMeasurement(). Im using the stm32f103RE microcontroller.
FixPoint1616_t threshold_high=(255);
FixPoint1616_t threshold_low=(350);status= VL53L0X_SetInterruptThresholds(pTestDev,
VL53L0X_DEVICEMODE_SINGLE_RANGING, threshold_low , threshold_high); status=VL53L0X_SetGpioConfig(pTestDev,0,VL53L0X_DEVICEMODE_SINGLE_RANGING,VL53L0X_GPIOFU NCTIONALITY_THRESHOLD_CROSSED_LOW, VL53L0X_INTERRUPTPOLARITY_LOW);status=VL53L0X_StartMeasurement(pTestDev);
best regards
jonas
#interrupt #vl53l0x #stm32f103 #interrupt-status-register2018-05-29 02:55 AM
I think your configuration means measurement would be run once.
so I think you should change the configuration from single to continuous measurements.
Then, the probability of interrupt occurrence would be increased.
When an interrupt occurs, the interrupt mask should be cleared.
Refer the configuration of
AlarmDemo()
function in en.X-CUBE-53L0A1.The code flows like these.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
.
.
.
VL53L0X_SetDeviceMode(VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
.
.
.
VL53L0X_SetGpioConfig(VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
VL53L0X_ClearInterruptMask();
VL53L0X_StartMeasurement();
VL53L0X_GetRangingMeasurementData();
VL53L0X_ClearInterruptMask();
2018-06-11 05:44 AM
I did it with a poll now. With high speed measurement, there is not much time wasted i guess. I will cange it to interrupt later on. Thanks!
2018-06-13 10:15 PM
The poll function of data measurement takes several hundreds of micro seconds.
So, you should consider this time works as blocking.
If this blocking time leads critical effect to your system,
then you should modify all blocking functions to none blocking functions.
Device the VL53L0x API functions and modify platform function as none blocking.
※ In my experience, the DMA functions of I2C shows more stable than Interrupt functions.
2018-06-25 04:40 AM
The entire measurement cycle is about 40ms now with the poll. I think for my system the blocked time is not critical, cause the MC waits for the result anyway.
However after changing the measurement to CONTINUOUS_RANGING, the GetRangingMeasurementData() shows error 3. Thats Min Range Fail and according to the manual UM2039 page 16 not even set by default. The error occurs 2 seconds after reset, before that the measurement is achieved without any error. I tried some delay to get time for the buffer, but that only delays the time till the error.
In deviation to your previous code, i did everything with a poll and didn't designed the hardware for interrupt.
oldtime=HAL_GetTick();
/*Ask for measurement data ready and wait 40 ms till data is ready */while ((MeasurementDataReady[k]!=1)&&(time<=40)) {
newtime=HAL_GetTick(); time=newtime-oldtime; status[10]=VL53L0X_GetMeasurementDataReady(); } /*Store measurement data in struct on device*/ status[11]=VL53L0X_GetRangingMeasurementData();status[12]=VL53L0X_ClearInterruptMask();