cancel
Showing results for 
Search instead for 
Did you mean: 
1 REPLY 1
John E KVAM
ST Employee

​I stole this answer from a similar post:

This one is easy - and fun too.

Go to the ST web site and download the CUBE-MX software. It's free.

STM32CubeMX- Development ToolsSTM32Cube initialization code generator.

Download here - STM32CubeMX

Run this application. Enter your board or MPU.

Enter which ST devices you have and which PIOs you want to attach and whatever you have hooked up.

Because it knows the chip, or the board and all the ST sensors, you can just attach them to whatever your hardware guy came up with.

 

Hit the 'build software' button and you will get all the initialization code, and the driver code and everything else you need.

 

In the main.c function go to the bottom and look for the comment 'USER CODE'. Put your stuff there.

 

And if you need to change something, just run it again. It will re-generate the code - and your modifications will still be in there.

 

If you want to, you can also try Atollic TrueStudio.

This is the STM32CubeMX combined with a complete IDE and debugger. (It's based on Eclipse, written by Atollic, and ST bought Atollic just so we could give the code away for free.)

The CubeIDE is an Integrated Development Environment. Based on open-source solutions like Eclipse or the GNU C/C++ toolchain, this IDE includes compilation reporting features and advanced debug features. It also integrates additional tools such as STM32CubeMX (natively included within STM32CubeIDE).

Download here - STM32CubeIDE

Between STM32CubeMX and Atollic, it's one great idea.

(And no, I don't work for either of those groups.)

Give it a try - it will solve all your initialization issues.

As to what Functions the VL53L0X functions are...

You can get by calling a couple of Init commands, a couple of setup commands, a 'go'' command, an 'are we done yet loop' and a 'give me the answer command'

By downloading the API, you get a lot of examples that should help you out.

STSW-IMG005     STVL53L0X API (Application Programming Interface and documentation)

Traverse the code looking for the examples directory, pick one, Then open main.c - it will show you how to setup and run.

That board is a fine bread-board example, so if you get the power, ground,  I2C and remember to pull up the Shutdown pin, you will be fine.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.