VL53L8 not working with code
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.
