cancel
Showing results for 
Search instead for 
Did you mean: 

SATEL-VL53L8 + ESP32 => VL53L8CX ULD Loading failed

milukic
Associate II

Hello everybody,

I have connected a SATEL-VL53L8 board to my ESP32, and I am trying to run the basic ranging example, using ULD driver. When I run the example, I get VL53L8CX ULD Loading failed in the serial terminal. Trying to figure out what's wrong, I have connected a logic analyzer to the SPI bus, so here is what I know so far:

  1. The vl53l8cx_is_alive() function gets a proper response from the chip (0xF0, 0x0C), indicating that the hardware is connected properly, and the SPI bus communication works as expected:
    milukic_0-1708538107965.png

     

  2. The function vl53l8cx_init goes on, and the firmware image is downloaded in 3 pieces (32K + 32K + 20K). There is a piece of code (lines 335-342) that checks if the FW is correctly downloaded. There is a single read command, and the value read from 0x7FFF is 0x00, and I'm not sure whether this could be an indication of the success status.  

    /* Check if FW correctly downloaded */
    status |= WrByte(&(p_dev->platform), 0x7fff, 0x01);
    status |= WrByte(&(p_dev->platform), 0x06, 0x03);
     
    status |= WaitMs(&(p_dev->platform), 5);
    status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
    status |= RdByte(&(p_dev->platform), 0x7fff, &tmp);
    status |= WrByte(&(p_dev->platform), 0x0C, 0x01);
    milukic_1-1708538789889.png
  3.  The definitive indication of failure occurs in the function _vl53l8cx_poll_for_mcu_boot. The value of 0x00 is being read from the address 0x06 in the loop for 500 times, indicating that the MCU fails to boot.

    milukic_2-1708540300044.png

Any help on this issue would be highly appreciated.

Kind regards

4 REPLIES 4
John E KVAM
ST Employee

If your code were successfully downloaded the _vl53l8cx_poll_for_mcu_boot would pass. It's not.

The code tries to boot when the last byte of program space is written. 

So, either the code was not completely written, or it wasn't written correctly. 

The first thing to check is if your MCU can write a 32K chunk all in one go.

Many of them cannot.

Might want to check the status of all those I2C writes and make sure they pass.

You got the 'Is_Alive' message, so your I2C is working, and the chip is out of reset. 

You are close.

-john


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. It helps the next guy.

Hi John, and thanks for your answer.


Actually, it's using SPI communication. As far as I can see from the logic analyzer, the size of the code chunks is not an issue, and the values sent correspond to those in the VL53L8CX_FIRMWARE lookup table. 

milukic_0-1708616057498.png

Unfortunately unlike I2C, there is no ACK on the SPI bus, so there is no way to check if every single byte of the firmware has been accepted by the slave device. Ca you please explain how this part of code /* Check if FW correctly downloaded */ works?

Kind regards

 

  

the check for booted simply queries a location that changes when the code gets running. 

No change -> no running code.

What speed are you running your SPI?  I read a different post that said that if you run the SPI too slowly, the sensor interface does NOT work. As odd as it seems, try speeding up the SPI bus.

See the post at:

Re: VL53L8CX firmware loading over SPI fails if it... - STMicroelectronics Community

It's all I can think of.

- john


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. It helps the next guy.

The clock frequency was 250kHz previously, now it's 1MHz, but still to no avail.

If I'm not mistaken, this sequence should read the FW checksum, and the value is 0x00000000.

milukic_1-1708631591223.png

I'm running out of ideas at this point...