cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for VL53L4ED documentation

Brazdil
Associate

Hi everybody.

Please help me. 

I bought a VL53L4ED sensor and would like to learn how to use it.
I have found a number of documents and driver examples, but have been unable to find a document describing the internal registers and their function. (programming manual) .

I must be looking for it wrong. Can you please direct me to the proper document?
Thank you very much.

 Jaroslav

5 REPLIES 5
John E KVAM
ST Employee

I just responded to someone with a similar complaint.

Please don't hate me.

But ST does not publish the register map. Instead we publish the API. It's 

STSW-IMG044

It contains simple C functions that enable everything the chip can do. Start there, read that. 

There are lots of examples. 

There are several reasons for not publishing the register map. 

1) Too many registers. I'm sure you could write a driver given the register map, but you'd end up hating ST forever.

2) Some of the register settings would cause your application to not meet the specification in the Datasheet, and again you would hate us.

3) It would be too hard to support. We'd spend the rest of our days looking through code with one wrong register setting. And when we couldn't find the error - you'd end up hating us.

But honestly it took us years to write that code; and it works; and it's validated. 

There is the firmware in the chip. So rather than a bunch of I2C registers you are actually using the I2C to communicate with firmware thinly vailed as hardware registers. 

Is it a perfect solution? No.

Is it annoying? Yes, undoubtedly. People hate being told they cannot dig into stuff. I don't like it either. 

But it's how we've decided we can best support our customers, and so I'm going to have to live with it.

 


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

Hi John.

Thank You for the respons and please apologize my english.

I had downloaded the api (and a lot of pdfs)  before I posted here on the forum.

I spent two days to understand the driver and to adapt it for my HW. I use Example_1_ranging_basic example.

I had some minor problems probably with the I2C timing,
I tried to upload the configuration in one block, I couldn't do it.
I succeeded with uploading byte by byte.

I can now read the correct ID by VL53L4ED_GetSensorId,

VL53L4ED_FIRMWARE__SYSTEM_STATUS   as 0x03   (thats OK),


I do the configuration as VL53L4ED_SensorInit, ( with 0 and also with 0x40 on the end of array (0x87))

I tried  VL53L4ED_StartRanging (I read a zero from the VL53L4ED_INTERMEASUREMENT_MS register)

but I finish in the VL53L4ED_CheckForDataReady procedure
to test the Ready state.

I read 0x11 from VL53L4ED_GPIO_HV_MUX__CTRL
and 0x03 from VL53L4ED_GPIO__TIO_HV_STATUS,

I get a 0 as result, (not ready).

Because I have no idea what is the meaning of those registers and the bits in them,
I can't look for an error. It's probably some small thing, but there's nothing to go by.
I have no idea which register to look in to see if the circuit is running.

I can read :
VL53L4ED_RESULT__RANGE_STATUS ((uint16_t)0x0089)    => 0
VL53L4ED_RESULT__SPAD_NB ((uint16_t)0x008C)               => 0
VL53L4ED_RESULT__AMBIENT_RATE ((uint16_t)0x0090)     => 0xFF00   / may be thats no correct byte order
VL53L4ED_RESULT__SIGMA ((uint16_t)0x0092)                     => 0 
VL53L4ED_RESULT__DISTANCE ((uint16_t)0x0096)               => 0

I have my HW with Kinetis MK20Dx265 :

* pin 1 (GND) of the VL53L4ED   connected to GND
* pin 2 (VDD) of the VL53L4ED   connected to 3V3 
* pin 3 (SCL) of the VL53L4ED    connected SCL of the Kinetis MCU
* pin 4 (SDA) of the VL53L4ED   connected SDA of the Kinetis MCU
* pin 5 (GPIO1) of the VL53L4ED  NC
* pin 6 (XSHUT) of the VL53L4ED connected to 3V3 
*/

it's very hard for me to find a bug without knowing the function of the circuit. 

I need to at least know what It mean when I read the 

I read 0x11 from VL53L4ED_GPIO_HV_MUX__CTRL
and 0x03 from VL53L4ED_GPIO__TIO_HV_STATUS,

and why it is not ready state.

 

Annoying  is,  that  I can only look at non-functioning device now.
May be I've just made some kind of schoolboy bug rewriting the driver.

Can You help me please?

We like the circuit, we would like to use it to measure short distances.

 

Best regards

 Jaroslav

 

John E KVAM
ST Employee

you have an I2C issue and I'm 99% sure it's a byte swap issue. Although word-swap is also possible.

I put some code in below. 

See if you can insert that code into your project. 

Just after getting the I2C initialized and the sensor powered up, see if you can get this to run.

It writes byte and reads back words. They should match.

it also does longwords and strings of bytes. 

Give it a shot.

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

That code lacks a little documentation. So look at this as well.

The doc was written with an VL53L1 in mind, so it's not exact, but it's close enough. 

all the VL53L sensors have the same I2C logic.

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

One of the standard ways of dealing/debugging this type of black-box type stuff is to work with the original materials on the original platform (ie STM gear), with that knowledge/working you can pivot into secondary architectures, and can contrast the relative behaviours. This can be done by adding instrumentation, or wrapping of key function, OR externally with the logic analyzer.

 

Yes, does sound like an I2C or driver level porting issue.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..