Good day, I am programming an esp32s3 microprocessor in an ESP-IDF environment. I would like to connect it with one sensor (in the future with four) TOF VL53L4CD from ST Microelectronics (LINK1). I managed to establish communication with the sensor in the Arduino IDE, it works fine there without problems. In ESP-IDF I also manage to communicate with the sensor via i2c. However, I am a beginner and I am having a lot of problems implementing the library for this sensor (LINK2). I get an error when calling the function VL53L4CD_SetI2CAddress() :
I get a Guru Meditation error when calling this function:
Line 48 in the platform.c file is :
I used the debugger and it turned out that the indices and have the value 0x00 despite their previous declaration :
If there is a knowledgeable person on the forum who would be willing to help me, I would be grateful. I am using ESP_IDF via Visual Studio Code
, I have imported all the files from the sensor library into the main folder for convenience I hope this is not a problem:
I will be happy to post additional details if needed.
Kind regards Stanisław Kaczmarek
LINK1: https://www.st.com/resource/en/datasheet/vl53l4cd.pdf
LINK2: https://github.com/STMicroelectronics/x-cube-tof1
The whole code (in the dirt) :
[i]AI: Could you show how you create and initialise the dev structure (e.g. VL53L4CD_Dev_t) and how you pass it to the VL53L4CD_SetI2CAddress function? I'm referring to the bit of code where you assign the pointer to the IO and call the library functions.
VL53L4CD_IO_t io_config = {
.Init = My_I2C_Init,
.DeInit = My_I2C_DeInit,
.Address = 0x29,
.WriteReg = My_WriteReg,
.ReadReg = My_ReadReg,
.GetTick = My_GetTick
};
AI: Have you made any changes to the VL53L4CD library files or the way it integrates into the ESP-IDF project (e.g. modifications to structures, header files, or other unusual steps when importing into the main folder)? If so, please describe them briefly.
I have only added additional logs to facilitate debugging via the serial port, I have not changed the mechanics of the code.
Code: text
I get a Guru Meditation error when calling this function:
Code: text
Line 48 in the platform.c file is :
Code: text
I used the debugger and it turned out that the indices
Code: text
Code: text
Code: text
If there is a knowledgeable person on the forum who would be willing to help me, I would be grateful. I am using ESP_IDF via Visual Studio Code
, I have imported all the files from the sensor library into the main folder for convenience I hope this is not a problem:
I will be happy to post additional details if needed.
Kind regards Stanisław Kaczmarek
LINK1: https://www.st.com/resource/en/datasheet/vl53l4cd.pdf
LINK2: https://github.com/STMicroelectronics/x-cube-tof1
The whole code (in the dirt) :
Code: text
[i]AI: Could you show how you create and initialise the dev structure (e.g. VL53L4CD_Dev_t) and how you pass it to the VL53L4CD_SetI2CAddress function? I'm referring to the bit of code where you assign the pointer to the IO and call the library functions.
VL53L4CD_IO_t io_config = {
.Init = My_I2C_Init,
.DeInit = My_I2C_DeInit,
.Address = 0x29,
.WriteReg = My_WriteReg,
.ReadReg = My_ReadReg,
.GetTick = My_GetTick
};
AI: Have you made any changes to the VL53L4CD library files or the way it integrates into the ESP-IDF project (e.g. modifications to structures, header files, or other unusual steps when importing into the main folder)? If so, please describe them briefly.
I have only added additional logs to facilitate debugging via the serial port, I have not changed the mechanics of the code.