cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with VL6180X returning incorrect value when reading the RESULT__RANGE_RETURN_CONV_TIME register.

AGome.7
Associate II

So from my understanding, after polling the sensor we can read directly from the RESULT__*** registers to reveal things such as distance, return rate, error code and such to view the results from the sensor range measurements. However, I've seen that when reading the RESULT__RANGE_RETURN_CONV_TIME register, it returns the same number, 16777215 microseconds (0x00FFFFFF). This number should be waaaay smaller that (below the Max_Convergence_Time threshold), and it should also change based on the target's distance and reflectance.

Below I have a snippet of a terminal printing out values from a ToF sensor's measurements. I used my hand as a target and waved up and down perpendicular to the sensor in an attempt to see a change in the convergence time, but as we can see it stays the same.
_legacyfs_online_stmicro_images_0693W00000dDK9j.png 

Is there something I am missing?

2 REPLIES 2
Zhiyuan.Han
ST Employee

Hi

I did same test, the rtnConvTime should not be a constant value. I was using API to read all the ranging result.

Inside _GetRateResult(dev, pRangeData) function, there is a ReadDword function for RESULT_RANGE_RETURN_CONV_TIME.

 status = VL6180_RdDWord(dev, RESULT_RANGE_RETURN_CONV_TIME, &m_rtnConvTime);

distance=36; status=0; ambient=270; rtnConvTime=155

distance=33; status=0; ambient=120; rtnConvTime=150

distance=30; status=0; ambient=232; rtnConvTime=155

distance=30; status=0; ambient=160; rtnConvTime=150

distance=30; status=0; ambient=116; rtnConvTime=154

distance=27; status=0; ambient=394; rtnConvTime=152

distance=24; status=0; ambient=77; rtnConvTime=154

distance=24; status=0; ambient=193; rtnConvTime=155

distance=24; status=0; ambient=278; rtnConvTime=151

distance=18; status=0; ambient=0; rtnConvTime=151

distance=18; status=0; ambient=348; rtnConvTime=155

distance=15; status=0; ambient=157; rtnConvTime=152

distance=15; status=0; ambient=148; rtnConvTime=162

distance=15; status=0; ambient=111; rtnConvTime=162

distance=12; status=0; ambient=389; rtnConvTime=154

distance=9; status=0; ambient=270; rtnConvTime=155

distance=9; status=0; ambient=259; rtnConvTime=162

distance=9; status=0; ambient=194; rtnConvTime=154

distance=6; status=0; ambient=111; rtnConvTime=162

distance=6; status=0; ambient=272; rtnConvTime=154

distance=6; status=0; ambient=194; rtnConvTime=154

so suggest you check I2C Dword read/write functions.

Br

Zhiyuan.Han


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.
AGome.7
Associate II

Yea, I figured out my issue, and it was related to the I2C Dword read/write functoins. In my setup, I am using an I2C to Serial ftdi chip to communicate to the ToF sensors using my computer. Issue was that the driver was incorrectly setting the ACK bit in between reads from the sensor's 32bit registers, so it resulted in bad data. I fixed it and it's now returning valid rtnConvTimes. Thanks for the suggestion!