cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-NUCLEO-F446RE Interface with TOF VL53L0X Sensor shown error

Ra.1
Associate II

I am totally new to STM please help.

I am using STMCUBE IDE v1.8.0 with STM32 NUCLEO-F446RE development board and TOF VL53LOX sensor .

I get a software project from official ST website https://www.st.com/content/my_st_com/en/products/ecosystems/stm32-open-development-environment/stm32cube-expansion-software/stm32-ode-sense-sw/x-cube-53l0a1.license=1644470633852.product=X-CUBE-53L0A1.version=1.2.0.html

and i open the project and then build it and build successfully and then i upload it.

i need to take a sensor readings but it shows some error in serial monitor as below

13:07:18.889 -> [Err] XNUCLEO53L0A1_Init l 392 	I2C Expander @0x86  detected
13:07:18.889 -> Hi I am Ranging VL53L0X mcu STM32F401xE
13:07:18.889 -> [Err] XNUCLEO53L0A1_SetDisplayString l 783 	Set i/o
13:07:19.539 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 0 state 0 
13:07:19.539 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 1 state 0 
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 2 state 0 
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 0 state 1 
13:07:19.585 -> #0 Read id fail
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 0 state 0 
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 1 state 1 
13:07:19.585 -> #1 Read id fail
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 1 state 0 
13:07:19.585 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 2 state 1 
13:07:19.632 -> #2 Read id fail
13:07:19.632 -> [Err] XNUCLEO53L0A1_ResetId l 478 	expander i/o error for DevNo 2 state 0 
13:07:19.632 -> [Err] XNUCLEO53L0A1_SetDisplayString l 783 	Set i/o
13:07:20.648 -> [Err] XNUCLEO53L0A1_SetDisplayString l 783 	Set i/o

Could anyone tell what's the error and how to solve it.

Thanx in advance😊.

1 REPLY 1
John E KVAM
ST Employee

The problem with the code we deliver is that it runs on the Nucleo F401RE MCU. Using any other STM32 will 'almost' work but the PIOs are different as is the clock timing.

So what I'm guessing is that you are trying to read from PIOs that are not configured as I2C or, if they are, they are not the ones the sensor is hooked to.

One easy solution is to buy a Nucleo-F401RE, but if that's not the MCU you want to use than that does not help.

Next try is to use the STM32CubeMX program and build the main bit of code for your MCU.

Then take the main.c from the old bit of code and compare it side-by side with the output of the CUBEMX.

The CUBEMX code setups up all the registers for your MCU, so copy that into the main.c of the downloaded code.

With a little luck it will work.

As a last resort, use the output of the STM32CubeMX as the base and pull the files from the VL53L0X API distribution into the CubeMX created project.

  • john

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'