Skip to main content
LCord.1
Associate II
October 8, 2021
Question

Cannot load Firmware to VL53L5CX

  • October 8, 2021
  • 4 replies
  • 1406 views

With the following code the VL53L5CX should get it's firmware uploaded.

"   /* Download FW into VL53L5 */

   status |= WrByte(&(p_dev->platform), 0x7fff, 0x09);

   status |= WrMulti(&(p_dev->platform),0,

           (uint8_t*)&VL53L5CX_FIRMWARE[0],0x8000);

   status |= WrByte(&(p_dev->platform), 0x7fff, 0x0a);

   status |= WrMulti(&(p_dev->platform),0,

           (uint8_t*)&VL53L5CX_FIRMWARE[0x8000],0x8000);

   status |= WrByte(&(p_dev->platform), 0x7fff, 0x0b);

   status |= WrMulti(&(p_dev->platform),0,

           (uint8_t*)&VL53L5CX_FIRMWARE[0x10000],0x5000);

   status |= WrByte(&(p_dev->platform), 0x7fff, 0x01);

"

 (code is from https://github.com/simondlevy/VL53L5 for arduino)

I get an Error saying failed to write 0x8000 bytes to 0x00. (see line 3)

So not even the first byte of the firmware gets transmitted, why is that so?

Thanks for any answers or pointers

Lucordes

PS the firmware is 86020 bytes why would it only write 0x8000(32768 decimal) bytes?

This topic has been closed for replies.

4 replies

John E KVAM
ST Employee
October 8, 2021

Some MCUs have a limit to the number of bytes they can write in one go. I'm going to guess you are exceeding that limit by a lot.

Some MCUS are limited to 16, 64 or 128 bytes per write.

The trick is to re-write the function to do the transmission in chunks of the correct size.

  • john
EXUE.2
ST Employee
October 11, 2021

it is write 0x8000(32768 decimal) bytes one time, write 3 times can cover 86020 bytes .

John E KVAM
ST Employee
October 11, 2021

If you have known working code and the I2C write will not complete, there are only a couple of failure modes.

Either the Power is not correct, or the I2C is not on.

So double check the power to make sure it's correct and double check pin A1 (I2C reset is grounded).

With proper power and the I2C grounded the sensor should come up with it's bootloader running.

  • john
LCord.1
LCord.1Author
Associate II
October 18, 2021

The code was not working properly but there is a fix on the github that fixed it. But thanks anyway for your answers :D

L