Skip to main content
Associate II
December 1, 2025
Solved

How to Use VL53L0X API With STM32H747I-DISCO (I2C3) – Functions Not Executing Inside FreeRTOS Task

  • December 1, 2025
  • 1 reply
  • 456 views

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 

Best answer by John_Kvam

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

1 reply

John_KvamBest answer
Associate
December 2, 2025

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

"If this or any post solves your issue, please mark them as ""Accept as Solution"". It really helps the next guy.And if you notice anything wrong do not hesitate to ""Report Inappropriate Content"".I am a recently retired ST Employee. My former username was John E KVAM."