2025-11-30 11:07 PM - last edited on 2025-11-30 11:39 PM by Peter BENSCH
Hello community,
I am working with the VL53L0X Time-of-Flight distance sensor and the official ST API driver (VL53L0X API package).
My hardware platform is:
STM32H747I-DISCO board (CM7 core)
I2C3 used to interface the VL53L0X
FreeRTOS running on CM7
Display controlled using TouchGFX
I copied the VL53L0X API (platform.c, platform.h, vl53l0x_api., vl53l0x_platform. etc.) into my STM32 project.
Issue:
When I call any API functions Inside a FreeRTOS task, the code does not proceed beyond the first API call.
The task appears to get stuck, and my LCD (TouchGFX) stops updating as well.
When I comment out these VL53L0X API functions, FreeRTOS and the LCD work normally.
FYI I have attached Latest API
Solved! Go to Solution.
2025-12-02 3:33 PM
First things first. See if anything is hitting the I2C lines. The code was written 'generically' so it would be adaptable to any MCU. But that means it has to be tweaked for a specific MCU. And that is what the Platform.c is all about.
Depending on who wrote that or what MCU it was for, it might have to be adapted.
Put a scope on the I2C clock or data and see if it wiggles.
If you don't get a wiggle, track the code with a debugger and follow it along to see where it goes.
You should end up at the hardware level I2C write or read.
From there, unfortunately it's on you.
But do check GitHub and see if someone has already done it.
Search for the VL53L0 and your MCU. You might get lucky.
- john
2025-12-02 3:33 PM
First things first. See if anything is hitting the I2C lines. The code was written 'generically' so it would be adaptable to any MCU. But that means it has to be tweaked for a specific MCU. And that is what the Platform.c is all about.
Depending on who wrote that or what MCU it was for, it might have to be adapted.
Put a scope on the I2C clock or data and see if it wiggles.
If you don't get a wiggle, track the code with a debugger and follow it along to see where it goes.
You should end up at the hardware level I2C write or read.
From there, unfortunately it's on you.
But do check GitHub and see if someone has already done it.
Search for the VL53L0 and your MCU. You might get lucky.
- john