cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L5CX driver implementation

chiragTeksun123
Associate II

I want to limpet  VL53L5CX driver so i used VL53L5CX_SimpleRanging driver for reference.

so i can Enable USE_BARE_DRIVER ? and i got proper output?

or you can give any example code where USE_BARE_DRIVER used ,

so i can use it and implement. 

Also below data is required to write

/* 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);

1 ACCEPTED SOLUTION

Accepted Solutions

If you face that sensor exactly perpendicular to a will, all 16 zones should give you the same answer. We have converted the radial-to-perpendicular for you. No need to account for fact that the light travels farther to the edges than to the center. 

If you only want one number, you are free to simply average them. 

Although I think I'd do a weighted average. I'd give the 4 zones in the center more influence, and less influence to the outer zones. The theory being that what is directly in front of you is more important that the edges. 

But it's entirely up to you.

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

View solution in original post

3 REPLIES 3
John E KVAM
ST Employee

There seems to be an issue with understanding. In the Bare driver download you will get C:\...\VL53L5CX_ULD_driver_1.3.11

And in this directory is both the bare driver and some example code. 

If you have purchased the P-Nucleo-53L5A1 (and I really recommend you do) you could use the code in CubeIDE_F401RE_Example to single step through a working example. And if you replace the main.c with one of the example codes in 'example' directory, you get many ways to run. 

Even in you don't have the P-Nucleo-53L5A1, try downloading the STM32CubeIDE development system. It's free. Open the IDE and use the editor to simply follow the code. But if you have the P-Nucleo-53L5A1, you can single step through to the examples and really see what is happening. 

And those big writes are mandatory. The sensor has a pretty amazing MCU in it, and you are downloading the firmware. (And a word of warning - lots of MCUs do not have the ability to do 0x8000 byte I2C writes. Might have to break that up.)

 

 

 

 


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,

Thank you for your quick response.

I used Zone mapping 4x4,

There are 16 zones and each zone give me distance value in mm,

so how i can find final distance value?I want to do averaging?

 

If you face that sensor exactly perpendicular to a will, all 16 zones should give you the same answer. We have converted the radial-to-perpendicular for you. No need to account for fact that the light travels farther to the edges than to the center. 

If you only want one number, you are free to simply average them. 

Although I think I'd do a weighted average. I'd give the 4 zones in the center more influence, and less influence to the outer zones. The theory being that what is directly in front of you is more important that the edges. 

But it's entirely up to you.

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