cancel
Showing results for 
Search instead for 
Did you mean: 

Could not receive the true unswer from VL53L1

niltec
Associate II

Gentlemen! Sorry for bothering you.

I try to use VL53L1 with the Light Driver.

The power level is 3.0 V, so I changed the Initialization data array, cell 0x2E from 0x00 to 0x01 and cell 0x2F from 0x00 to 0x01.

I wait for the Device ready (SensorState = 0x03), than initialize of the Device (I checked of the ASK by Oscilloscope - it was good).

I could not receive 0xEEAC by readind a word from 0x010F and 0x0110 cells. Insted of this I stable receive 0xEACC.

I started of the measurement in loop and checked of the CheckForDataReady () function. The DataByte was constantly 0x0.

May be somebody could give me an advice where is my error?

4 REPLIES 4
niltec
Associate II

Sorry, I have forgotten of the important moment. Could anybody give me a full list of registers with the meaning of the bits values (or Internet address of the corresponding document). I could not find of the important data.

John E KVAM
ST Employee

Unfortunately ST does not publish the register map for this device. It's a pretty complex device and there are way too many settings that would just get users in trouble. It's way better to use the API we publish.

As for voltage I suggest:

1)	Modify the code in VL53L1X_def.h
 
const uint8_t VL51L1X_DEFAULT_CONFIGURATION[] = {
0x00,  /* Reg 0x2d is set bit 2 and 5 at 1 for mode fast plus (1MHz I2C), else don't touch*/
#ifdef USE_I2C_2V8
0x01, /* Reg 0x2e is don't touch bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1 for 2.8V*/
#else
0x00, /* Reg 0x2e is don't touch bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1 for 2.8V*/
#endif

You can do the same thing for the Interrupt line (0x2F).

The EACC you got is correct. There is a terrible typo in the data sheet.

My code, that works just fine is:

 while(sensorState==0){
		status += VL53L1X_BootState(dev, &sensorState);
	HAL_Delay(2);
  }
  printf("Chip booted\n");
 
  /* This function must to be called to initialize the sensor with the default setting  */
  status += VL53L1X_SensorInit(dev);
 
  /* Optional functions to be used to change the main ranging parameters according the application requirements to get the best ranging performances */
  status += VL53L1X_SetDistanceMode(dev, 2); /* 1=short, 2=long */
  status += VL53L1X_SetTimingBudgetInMs(dev, 100); /* in ms possible values [20, 50, 100, 200, 500] */
  status += VL53L1X_SetInterMeasurementInMs(dev, 100); /* in ms, IM must be > = TB */
//  status += VL53L1X_SetOffset(dev,20); /* offset compensation in mm */
//  status += VL53L1X_SetROI(dev, 16, 16); /* minimum ROI 4,4 */
//	status += VL53L1X_CalibrateOffset(dev, 140, &offset); /* may take few second to perform the offset cal*/
//	status += VL53L1X_CalibrateXtalk(dev, 1000, &xtalk); /* may take few second to perform the xtalk cal */
  printf("VL53L1X Ultra Lite Driver Example running ...\n");
  status += VL53L1X_StartRanging(dev);   /* This function has to be called to enable the ranging */
  while(1){ /* read and display data */
	  while (dataReady == 0){
		  status += VL53L1X_CheckForDataReady(dev, &dataReady);
		  HAL_Delay(2);
	  }
	  dataReady = 0;
	  status += VL53L1X_GetRangeStatus(dev, &RangeStatus);
	  status += VL53L1X_GetDistance(dev, &Distance);
	  status += VL53L1X_GetSignalRate(dev, &SignalRate);
	  status += VL53L1X_GetAmbientRate(dev, &AmbientRate);
	  status += VL53L1X_GetSpadNb(dev, &SpadNum);
	  status += VL53L1X_ClearInterrupt(dev); /* clear interrupt has to be called to enable next interrupt*/
	  printf("%u, %u, %u, %u, %u\n", RangeStatus, Distance, SignalRate, AmbientRate, SpadNum);
  }
}

Notice how I used "status +="? As all status returns should be zero, somewhere in your loop put a single check for a non-zero return.

I expect you have one somewhere.

The only other failure I have ever heard of is a glitch on the reset line - that sometimes reboots the chip. (That line is why too sensitive.)

So if your I2C line is still doing I/O, it could be that your chip rebooted. Stronger pull-up is suggested.


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. It helps the next guy.
niltec
Associate II

Good day, John!

Really thanks for the answer.

_r_y_a_n
Associate

@John E KVAM​ 

"The EACC you got is correct. There is a terrible typo in the data sheet."

I just hit this same problem. Thanks for the updated information in this thread - I thought I was going mad. 😀

Any chance they can update that data sheet to avoid confusing future readers?