cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L8 API not working

Arthur_Dupont
Associate

Hello, i've recently made a board including a VL53L8 Time of flight sensor connected to an STM32G071 over SPI.
I'm using the VL53LMZ api to connect to it and after modifying the platform.c file i've managed to talk to the sensor (vl53lmz_is_alive() sets the IsAlive flag to 1).
But all the other functions fail after that, i've managed to track down the problem using the debugger to the line 5 below:

 

	/* Enable FW access */
	if (p_dev->revision_id == (uint8_t)REVISION_L8) {
		status |= WrByte(&(p_dev->platform), 0x7fff, 0x01);
		status |= WrByte(&(p_dev->platform), 0x06, 0x01);
		status |= _vl53lmz_poll_for_answer(p_dev, 1, 0, 0x21, 0xFF, 0x4);
	} else {

 

within vl53lmz_init().

It looks like the L8's register that is being monitored by this function is set to 0 and never changes.
I have verified the transmitted data using an oscilloscope and it is sending / receiving the correct data.

Since there is very little information provided by ST other than "use the API" i can't figure out what register/data should be modified to fix the problem.

Thank you for your help.


1 ACCEPTED SOLUTION

Accepted Solutions

Hello,
I ended up having to give the board to a colleague and he started from scratch again using the SPI example from the L8 ULD.
He ended up having great success with it and we don't really know what caused the problem in the first place since both our programs look similar in the platform.c file.

We had a poorly soldered ground lead that he ended up fixing so maybe that's what fixed it, who knows ?

Thank you for your help !

View solution in original post

2 REPLIES 2
John E KVAM
ST Employee

I'm really sorry I went on vacation and left you hanging. That must have been very frustrating. 

I'm generally bet on byteswap issues or inability of your processor to transmit an i2c packet of 0x8000 bytes.

But you are using an ST processor, and they are all the same when it comes to I2C/SPI. So that leaves out both of my ideas. 

Those lines occur very early on in the boot process. You have not done anything yet. So that leaves hardware setup I think. 

You say you checked it with a scope, and I believe you. In fact, you have gotten past one 'poll for answer', so there is some communication. 

Could it be that you have turned the sensor on and the power draw is pulling down the VDD? It's really alI I can think of.

If you still have the issue, respond and I'll try to help. But I'm hopeful you've solved it while I was on vacation.

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

Hello,
I ended up having to give the board to a colleague and he started from scratch again using the SPI example from the L8 ULD.
He ended up having great success with it and we don't really know what caused the problem in the first place since both our programs look similar in the platform.c file.

We had a poorly soldered ground lead that he ended up fixing so maybe that's what fixed it, who knows ?

Thank you for your help !