Skip to main content
Associate
August 5, 2023
Solved

VL53L8 not working with code

  • August 5, 2023
  • 3 replies
  • 3821 views

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.

Best answer by John E KVAM

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

3 replies

Anne BIGOT
Technical Moderator
August 7, 2023

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'
Associate
August 9, 2023

Hello,

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

Anne BIGOT
Technical Moderator
August 9, 2023

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'
Anne BIGOT
Technical Moderator
September 8, 2023

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'
Explorer
December 19, 2023

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

Anne BIGOT
Technical Moderator
December 20, 2023

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'
John E KVAM
John E KVAMBest answer
ST Employee
December 20, 2023

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