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

5 REPLIES 5
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


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

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


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

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...

Hello,

There was an issue inside the ULD as low frequency.

It has been fixed in the latest version (v1.2.2) of the ULD available here.

 


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'