Skip to main content
DHess.1
Associate II
September 6, 2021
Question

VL6180_SimpleRanging example using Bottom sensor

  • September 6, 2021
  • 2 replies
  • 1137 views

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

This topic has been closed for replies.

2 replies

DHess.1
DHess.1Author
Associate II
September 6, 2021

Attached code snippet only...

DHess.1
DHess.1Author
Associate II
September 7, 2021

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