cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L8 not working with code

BlackWhite
Associate II

I have a P-NUCLEO-53L8A1 development kit, which consists of an X-NUCLEO-53L8A1 connected to NUCLEO-F401RE. When I am using the GUI program STSW-IMG041, it can correctly get data. However, I am using the X-CUBE-TOF1 kit from this website link: https://www.st.com/en/ecosystems/x-cube-tof1.html. I compiled the example '53L8A1_SimpleRanging' located in 'en.X-CUBE-TOF1\Projects\NUCLEO-F401RE\Examples\53L8A1', but I encountered an error while running it: 'VL53L8A1_RANGING_SENSOR_Init failed. Check you're using ONLY the center device soldered on the shield, NO satellite shall be connected!' I debugged my code and found that it fails when trying to read the ID:
if (VL53L8CX_ReadID(&(VL53L8CXObj[Instance]), &id) != VL53L8CX_OK)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}

Since using the GUI program gives me data successfully, I believe the module itself should be fine. However, I can't initialize it using the code.

I look forward to receiving help from all the experts. Thank you very much.

1 ACCEPTED SOLUTION

Accepted Solutions

i had this issue. I tracked it to a mis-configured I2C. When I added the TOF software to the STM32_CubeMX, I realized the software knew nothing about the hardware configuration. Granted the CubeMX won't let you generate code if you have not assigned the pins, but there is no safeguard if you have them wrong. I ended up with the Nucleo board schematics and the schematic for the X-Nucleo53L8A1, and just tracing out the lines. (As a software guy - it was an enlighening experience.)

But based on my sample set of one, I'd double check the pin assignments.

If the EVAL GUI software works, you know your board works. So I'd not go there.

- john


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'

View solution in original post

9 REPLIES 9
Anne BIGOT
ST Employee

Hello

 

Can you please confirm that there is no SATEL connected to the X-Nucleo ?

Moreover, can you please confirm that the jumpers are set as stated in the documentation ?

 

Regards

 


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'

Hello,

I can confirm that the connections and jumpers are correct, because this connection method can correctly collect data using GUI programs

Hello

Did you try to load the .bin file delivered at the same place by just doing a drag and drop from the directory to the board ? 
We tried on our side and this bin file is workin. For that no SATEL has been connected to the X-Nucleo.
Regards


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'

I just copied the 53L8A1_SimpleRanging.bin file in the en.X-CUBE-TOF1\Projects\NUCLEO-F401RE\Examples\53L8A1\53L8A1_SimpleRanging\Binary folder to the directory on the board, but it still can't work.
I modified the Sample Code. If the NCS pin of VL53L8(PB6 in STM32F401) is set to high level, then the communication can be normal. In the sample, this pin is set to low level.
I read the VL53L8 datasheet and his description of this pin is:
I²C: I²C interface reset pin, active high. Toggle this pin from 0 to 1, then back to 0 to reset the I²C slave. 47 kΩ pulldown resistor required to GND.
SPI: Active low chip select. 47 kΩ pullup resistor required to IOVDD.

As shown in the datasheet, this pin takes effect at a high level. According to my understanding, it is in the recovery of I2C communication when it is at a high level, and communication should not be possible at this time. But in fact, when this pin is high, it can communicate. The sample code is consistent with the VL53L8 datasheet, but it is inconsistent with the actual phenomenon? Is there an error in the datasheet? Or is there something wrong with my board, since I don't have the circuit diagrams of these boards, I can't troubleshoot whether there is a problem with the board.
Can you tell me what the level status of this pin should be when it is in use? I will buy a few more modules of this kind to use in the future. I need to know how to use this module in order to program code.

Thanks.

Anne BIGOT
ST Employee

Hello

Sorry for the delay in the answer.
You can find the schematic of the boards here on the X-NUCLEO-VL5"L8A1 page. 

Can you check the jumper too ? 

Regards


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'
Upasana
Associate

Hi, I am working on the same board and same application and I am getting the same error. I am very new to this and not very proficient. I was wondering if you could share the the pinout config so simple ranging on the X-NUCLEO-VL5L8A1 ?
Any help from your side is greatly appreciated.

best,
Upasana

Hello Upasana,

What is the HW config you are using ? Is it boards available on st.com  ?

Are you using SATEL too ?

Regards

 


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'

i had this issue. I tracked it to a mis-configured I2C. When I added the TOF software to the STM32_CubeMX, I realized the software knew nothing about the hardware configuration. Granted the CubeMX won't let you generate code if you have not assigned the pins, but there is no safeguard if you have them wrong. I ended up with the Nucleo board schematics and the schematic for the X-Nucleo53L8A1, and just tracing out the lines. (As a software guy - it was an enlighening experience.)

But based on my sample set of one, I'd double check the pin assignments.

If the EVAL GUI software works, you know your board works. So I'd not go there.

- john


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'

I can confirm that it is a pin assignment issue - at least in my case. 

It wasn't the I2C but, instead, some of the control pins.

I'm using a 57L8A1 board plugged into a NUCLEO- F401RE board.

I followed the directions in UM3108 to generate the code for the SimpleRanging example and got the same error 

VL53L8A1_RANGING_SENSOR_Init failed
Check you're using ONLY the center device soldered on the shield, NO satellite shall be connected !

I realized that the directions in UM3108 apply to the 57L7A1 which has different pin assignments than the 57L8A1. After comparing the schematics, I figured out what needed to be changed to make the code work with the 53L8. I've highlighted the ones that differ in red:

FunctionGPIO for 53L7GPIO for 53L8
I2C1_SCLPB8PB8
I2C1_SDAPB9PB9
LPnPB4PB0
TOF_INTPA4PA4
PWR_ENPB0PA7
I2C_RESETPB3not needed

I used the above info to modify what I did on UM3108 pages 16+.

In the end, the GPIO assignments looked like this:

corresponding to page 20 fig 28 of UM3108:

fig 1.jpg

and page 23 fig 34:

fig2.jpg

Once I made these changes and re-compiled, the SimpleRanging app worked fine.

Brian