Error getting ranging data vl53l5x 8x8 mode.
When i measure my distance in 4x4 i don't have any issues at all. But I need to change it to 8x8 for my project.
To my knowledge you only need to change the resolution with vl53l5cx_set_resolution() to 8x8 and adjust the frequency accordingly. I have checked if my sensor is measuring with my webcam and it is a solid red light so not blinking or anything. And when i check the output it gives me this:
Initialized
data not ready??
data not ready??
data not ready??
data not ready??
data not ready??
data not ready??
data not ready??
data not ready??
data not ready??
Status ranging: 1
Error retrieving ranging data on device 0.
======== Device 0 ========
23, 33, 28, 20, 17, 14, 12, 6,
24, 33, 701, 26, 19, 15, 11, 10,
21, 31, 32, 25, 21, 17, 13, 12,
23, 31, 34, 30, 24, 18, 15, 13,
828, 27, 33, 33, 0, 22, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
Braking
Error while checking for data ready on device 0.
data not ready??
Error while checking for data ready on device 0.
data not ready??
Error while checking for data ready on device 0.
The data not ready is just waiting till it has measured but then i get an error from the vl53l5cx_get_ranging_data() for some reason and after my sensor is obviously done till restart. Does anyone know what I'm doing wrong?
This is the relevant part of my code:
for (int dev = 0; dev < NUMDEVICES-1; dev++) { // Loop through each device
// Power on each sensor separately by setting it's LPN pin high
HAL_GPIO_WritePin(VL53L5CXLpnPorts[dev], VL53L5CXLpnPins[dev], GPIO_PIN_SET);
HAL_Delay(15); // Allow time for the sensor to stabilize
while (true) {
status = vl53l5cx_check_data_ready(&devs[dev], &dataIsReady);
if (status != VL53L5CX_STATUS_OK) {
cout << "Error while checking for data ready on device " << dev << "." << endline;
}
if (dataIsReady) {
/* Retrieve the data */
status = vl53l5cx_get_ranging_data(&devs[dev], &result);
cout << "Status ranging: " << status << endline;
if (status != VL53L5CX_STATUS_OK) {
cout << "Error retrieving ranging data on device " << dev << "." << endline;
}
for (uint8_t index = 0; index < resolution; index++) {
distanceMap[index] = result.distance_mm[index];
}
// Power off each sensor separately by setting it's LPN pin low after measuring
HAL_GPIO_WritePin(VL53L5CXLpnPorts[dev], VL53L5CXLpnPins[dev], GPIO_PIN_RESET);
HAL_Delay(15);
break; // Exit the loop for this sensor once the measurement is done
} else {
cout << "data not ready??" << endline;
}
HAL_Delay(5);
}
std::tuple<uint8_t, uint8_t> devPriority = newTuple(dev, 1);
vl53l5xLogic(distanceMap, devPriority);
}
return CONTINUE;
}
