cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to start ranging on the vl53l8cx

RJRP
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
RJRP
Associate II

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

View solution in original post

3 REPLIES 3
Anne BIGOT
ST Employee

Hello,

The VL53L5CX and the VL53L8CX are not pin to pin comptible.

Did you modify your project regarding this change ?

Anne


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
AlexCloned
Associate III

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.

RJRP
Associate II

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