cancel
Showing results for 
Search instead for 
Did you mean: 

How do i use the vl53l1x driver with a LoRa-E5-STM32WLE5JC? I struggle with the plattform.h / plattform.c code.

AA.16
Associate III

Hello this is my first stm32 project. my goal is to use the stm32 to read sensor values and send them over lora to somewhere else. However i am not getting past reading a single value from the Sensor.

First of all there seems to be more than one version of the driver. I found one driver.zip with the following name: 'en.STSW-IMG007_v2.4.5' and another with the name 'en.STSW-IMG009_v3.5.1'. One seems to be a newer version and is using less files/space but it has tons of weird files in there that don't really have to do anything with the sensor? For example there is a canbus example for the STM32L4xx...

The IMG007 for some reason has plattform code for a windows machine. Why would i want to use this sensor with a windows machine? Its missing windows.h but i don't think i need it.

Which of these would be the right driver for me? And how would i go about using it? Do i 'just' implement the plattform files and then the sensor works? How would i know what has to be written in the plattform files? The sensor is not a normal i2c sensor where you write into registers and read from them.

I tried following this guide:

https://forum.digikey.com/t/adding-the-vl53l1x-driver-to-an-stm32cube-project/13276

but its for a different MCU and they just import platform.c code from some other project. Also further down they say that the driver they use is outdated and the new version is different. I tried their plattform code but of course its not working since i have a different MCU and a different HAL.

Please help me. I think i can use the IMG009 driver (since its newer and has less footprint). I don't know how i would start to implement the plattform code.

1 REPLY 1
John E KVAM
ST Employee

All STM32's use the same I2C platform and driver.

You are right about the IMG007 driver. Really no reason to use that one. And especially stay away from the Windows code.

For the VL53L1X use the IMG009. It's far easier to understand and does 95% of what anyone wants. If you need that extra 5% we can dig in later.

In the IMG009 code there is the platform layer. But it's empty. It was expected that user (you) would know enough about the MCU you were using to implement your own. But ST really should have sent you one for the STM32. And they did - we just hid it.

Have a look at the img009 delivery and look through the example code. There is a platform.c there. Use that one. It works on the STM32s.


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'