2023-11-02 11:14 AM
Hello,
I've already used the vl53l5cx and it worked flawlessly, so I decided to try the newest one. I'm working on an esp32s3 and a satel-vl53l8 using the ULD. I completed the platform file, and it initialized the sensor without errors. But when the sensor tries to start ranging, I get an VL53L8CX_STATUS_ERROR caused by two data sizes which should be the same but aren't.
//In vl53l8cx_api.c
//vl53l8cx_start_ranging()
if(tmp != p_dev->data_read_size)
{
status |= VL53L8CX_STATUS_ERROR;
}
I can’t figure out how to fix it. If you need any additional information, I will be pleased to answer.
Thanks
Solved! Go to Solution.
2023-11-11 02:44 AM
Thank you for your answers,
I discovered, after a lot of debugging, that the faulty function was the default implementation of SwapBuffer.
Here's my new implementation, if it helps anyone :
void SwapBuffer(uint8_t *buffer, uint16_t size) {
uint32_t i;
uint8_t tmp[4] = {0};
for (i = 0; i < size; i = i + 4) {
tmp[0] = buffer[i + 3];
tmp[1] = buffer[i + 2];
tmp[2] = buffer[i + 1];
tmp[3] = buffer[i];
memcpy(&(buffer[i]), tmp, 4);
}
}
And esp32s3's i2c supports these amount of data without any problem.
Have a nice day
Romain
2023-11-09 06:26 AM
Hello,
The VL53L5CX and the VL53L8CX are not pin to pin comptible.
Did you modify your project regarding this change ?
Anne
2023-11-09 11:57 AM - edited 2023-11-09 11:59 AM
Assuming that if you're using the Satel-Vl53l8 development board, you shouldn't have PCB layout errors, as it's already proven by your successful initialization. This leads us to believe that the read data does not match the expected quantity or there is some kind of misalignment.
What is the maximum data transfer size that your peripheral supports? When you programmed the WrMulti() function on your platform, did you consider that transfers might be longer than what the peripheral (assuming you're using I2C) supports? The same goes for byte alignment issues. It would be interesting to debug and see how much the difference is between tmp and p_dev->data_read_size. A clue might come from there if you haven't discovered it yet. Good luck. Alex.
2023-11-11 02:44 AM
Thank you for your answers,
I discovered, after a lot of debugging, that the faulty function was the default implementation of SwapBuffer.
Here's my new implementation, if it helps anyone :
void SwapBuffer(uint8_t *buffer, uint16_t size) {
uint32_t i;
uint8_t tmp[4] = {0};
for (i = 0; i < size; i = i + 4) {
tmp[0] = buffer[i + 3];
tmp[1] = buffer[i + 2];
tmp[2] = buffer[i + 1];
tmp[3] = buffer[i];
memcpy(&(buffer[i]), tmp, 4);
}
}
And esp32s3's i2c supports these amount of data without any problem.
Have a nice day
Romain