cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid range from VL6180X

BCoch
Senior

I have the X-NUCLEO-6180XA1 board working with an STM32G071 Nucleo board. However the range reading doesn't seem to change when the range to the object changes. If there is nothing in range, I correctly read 0x72 from the range status register, but if something is in range, I seem to always get a range around 0x09 to 0x0D, regardless of if the target is moved closer or further.

Is there some setting I might be missing? I'm initializing the registers as follows:

static const vl6180x_reg_value_t init_regs[] = {

/* REGISTER_TUNING_SR03_270514_CustomerView.txt */

{0x0207, 0x01},

{0x0208, 0x01},

{0x0096, 0x00},

{0x0097, 0xfd},

{0x00e3, 0x01},

{0x00e4, 0x03},

{0x00e5, 0x02},

{0x00e6, 0x01},

{0x00e7, 0x03},

{0x00f5, 0x02},

{0x00d9, 0x05},

{0x00db, 0xce},

{0x00dc, 0x03},

{0x00dd, 0xf8},

{0x009f, 0x00},

{0x00a3, 0x3c},

{0x00b7, 0x00},

{0x00bb, 0x3c},

{0x00b2, 0x09},

{0x00ca, 0x09},

{0x0198, 0x01},

{0x01b0, 0x17},

{0x01ad, 0x00},

{0x00ff, 0x05},

{0x0100, 0x05},

{0x0199, 0x05},

{0x01a6, 0x1b},

{0x01ac, 0x3e},

{0x01a7, 0x1f},

{0x0030, 0x00},

/* Recommended : Public registers - See data sheet for more detail */

{SYSTEM_MODE_GPIO1, GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT << GPIOx_FUNCTIONALITY_SELECT_SHIFT}, /* GPIO1 configured as active low interrupt output */

should not be changed.*/

{SYSRANGE_VHV_REPEAT_RATE, 0xFF}, /* sets the # of range measurements after which auto calibration of system is performed */

{SYSRANGE_VHV_RECALIBRATE, 0x01}, /* perform a single temperature calibration of the ranging sensor */

/* Optional: Public registers - See data sheet for more detail */

{SYSRANGE_INTERMEASUREMENT_PERIOD, (READING_INTERVAL_MS/10U - 1U)}, /* Set ranging inter-measurement period */

{SYSTEM_INTERRUPT_CONFIG_GPIO, CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY}, /* Configures interrupt on New range sample ready */

{SYSRANGE_THRESH_HIGH, 10},

{SYSTEM_INTERRUPT_CLEAR, INTERRUPT_CLEAR_ERROR|INTERRUPT_CLEAR_RANGING|INTERRUPT_CLEAR_ALS},

// end of VL6180x_Prepare

{SYSRANGE_START, MODE_START_STOP | MODE_CONTINUOUS}

};

2 REPLIES 2
John E KVAM
ST Employee

0x72 is not a range status, so you are doing something wrong here. 0x9 and 0xD are range status values you can get.

There is something odd here.

What addresses are you looking at for the results?


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

I was reading 0x72 (max convergence, range_measurement_ready) from the RESULT__RANGE_STATUS register 0x04D. So maybe the range is not meaningful when max convergence is set.

I did get this working though. My main problem was not realizing that it doesn't really work closer than about 10 mm.