cancel
Showing results for 
Search instead for 
Did you mean: 

VL6180_SimpleRanging example using Bottom sensor

DHess.1
Associate II

I'm trying to adapt the example code available on st.com for VL6180_SimpleRanging (STM32CubeExpansion_6180A1_V1.0.0 for STM32F401RE-Nucleo) so that the Bottom sensor is used, rather than the one soldered directly on the 6180XA1 expansion board (V2).

My intention was to keep all the sensors but the Bottom sensor inactive using their chip selects. The Bottom sensor is then addressed using the standard I2C address, no need to set another.

So I patched the function main() in file main.c as shown attached by defining a new compiler switch USE_BOTTOM_SENSOR.

Unfortunately the code does not work, the 7-segment constantly indicates "ErIn" because the call to VL6180_Prepare(theVL6180Dev) always fails with status 1.

Apparently I missed something, the question is what? I'm grateful for any hints.

Thank you and best regards

Daniel Hess

2 REPLIES 2
DHess.1
Associate II

Attached code snippet only...

DHess.1
Associate II

Meanwhile it became clear, where the problem was. The sensor definitions in the sample code were mixed up. In the file STM32CubeExpansion_6180A1_V1.0.0\Drivers\BSP\6180A1\6180a1.h the left and the bottom sensor IDs were confused. Perhaps my sample code is outdated and the issue already fixed?

Problem solved, it's working now.

Best regards

Daniel Hess