cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X standby power consumption too high in the ULP driver

qqzlqqzlqqzl
Associate II

Hello ST team, as mentioned in the title, I found that the power consumption when using the ULP library to drive TOF L1 is inconsistent with the manual. I'm using the official evaluation board vl53l1-satel. Below is my test code and power consumption data. In my code, you'll see both ULD and ULP libraries, but I'm actually only using the ULP library; the ULD library is commented out.

qqzlqqzlqqzl_0-1743056065061.png

qqzlqqzlqqzl_1-1743056078812.png

int main(void)
{

  /* USER CODE BEGIN 1 */
	uint16_t	dev=0x52;
	int status=0;
	volatile int IntCount;
  uint8_t byteData, sensorState=0;
  uint16_t wordData;
	
	uint8_t measurement_status;
	uint16_t estimated_distance_mm;
	uint16_t sigma_mm;
	uint16_t signal_kcps;
	uint16_t ambient_kcps;
	
  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_I2C1_Init();
  MX_TIM16_Init();
  MX_LPUART1_UART_Init();
  /* USER CODE BEGIN 2 */
	HAL_TIM_PWM_Start(&htim16,TIM_CHANNEL_1);
	printf("\r\n--MCU ready !--\r\n");
	I2C_Scan(&hi2c1); 
	//while(1)I2C_Scan(&hi2c1); 
  status = VL53L1_RdByte(dev, 0x010F, &byteData);
  printf("VL53L1X Model_ID: %X\r\n", byteData);
  status = VL53L1_RdByte(dev, 0x0110, &byteData);
  printf("VL53L1X Module_Type: %X\r\n", byteData);
  status = VL53L1_RdWord(dev, 0x010F, &wordData);
  printf("VL53L1X: %X\r\n", wordData);
	while(sensorState==0){
		status = VL53L1X_BootState(dev, &sensorState);
	HAL_Delay(2);
  }
  printf("Chip booted\r\n");
	
 /* This function must to be called to initialize the sensor with the default setting  */
  status = VL53L1X_ULP_SensorInit(dev);
	if(status) printf("init error\r\n");
  /* Optional functions to be used to change the main ranging parameters according the application requirements to get the best ranging performances */
	//VL53L1X_ULP_SetInterruptConfiguration(dev,0,0);
  status = VL53L1X_ULP_SetInterMeasurementInMs(dev, 500); /* in ms possible values [20, 50, 100, 200, 500] */
	status = VL53L1X_ULP_SetMacroTiming(dev, 20); //MacropPeriod
	status = VL53L1X_ULP_SetSignalThreshold(dev, 1600);
	status = VL53L1X_ULP_SetSigmaThreshold(dev, 50);
  //  status = VL53L1X_SetOffset(dev,20); /* offset compensation in mm */
  status = VL53L1X_ULP_SetROI(dev, 16); /* minimum ROI 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 ...\r\n");
	
  status = VL53L1X_ULP_StartRanging(dev);   /* This function has to be called to enable the ranging */
	if(status) printf("init error\r\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
	{
		HAL_Delay(100);
		status = VL53L1X_ULP_DumpDebugData(dev, 
																		&measurement_status, 
																		&estimated_distance_mm, 
																		&sigma_mm, 
																		&signal_kcps, 
																		&ambient_kcps);
		if (status == VL53L1X_ULP_ERROR_NONE) 
		{
			printf("Measurement Status: %u ", measurement_status);
			printf("Estimated Distance: %u mm ", estimated_distance_mm);
			printf("Sigma: %u mm ", sigma_mm);
			printf("Signal Rate: %u kcps ", signal_kcps);
			printf("Ambient Rate: %u kcps\r\n", ambient_kcps);
		} 
		else 
		{
			printf("Error reading measurement: %d\r\n", status);
		}
		VL53L1X_ULP_StopRanging(dev);
		HAL_Delay(2000);
		VL53L1X_ULP_StartRanging(dev); 
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
		//HAL_Delay(1000);
  }
  /* USER CODE END 3 */
}

 

3 REPLIES 3
qqzlqqzlqqzl
Associate II

My main confusion is why there are still several mA of power consumption when the TOF rangefinder completes measurement and enters software standby mode. My MCU and TOF have separate, independent power supplies. Also, when using the ULD library, the power consumption after ranging completion and entering software standby is only a few μA, which is consistent with the manual. Therefore, I don't think it's an issue with my hardware connections.When I pull XShut low, it consumes about 400μA of current at 2.8V supply (all my power to the TOF is 2.8V)。I also made some modifications to the circuit, removing the voltage regulator chip and shorting R21 to get closer to the device's power consumption, but I didn't remove the level shifting chip because when I removed this chip, the TOF stopped working for some reason.

qqzlqqzlqqzl_0-1743057347944.png

 

John E KVAM
ST Employee

I was completely confused until you mentioned 'level shifter chip'. Those things are the root of all evil. I know we need them sometimes, but they have caused me so much pain in the past that I've learned to hate them. 

Do you really need it?

Certainly, if you are going a long distance, they help. Of if your MCU needs the 5V I2C, you are kind of stuck. 

But the sensors I2C can handle I2C up to 3.6. 

But can we try something:

(The VL53L1, L3, and L4s all have the same I2C interface.)  

In the VL53L1 Sensor, there was a setting a bit of code in VL53L1_DataInit().

#ifdef USE_I2C_2V8
	Status = VL53L1_RdByte(Dev, VL53L1_PAD_I2C_HV__EXTSUP_CONFIG, &i);
	if (Status == VL53L1_ERROR_NONE) {
		i = (i & 0xfe) | 0x01;
		Status = VL53L1_WrByte(Dev, VL53L1_PAD_I2C_HV__EXTSUP_CONFIG,
				i);
	}
#endif

And you need:

#define VL53L1_PAD_I2C_HV__EXTSUP_CONFIG 0x002E

 This changes the expected mid-point of the I2C - and thus the point it clocks the bit. As the mid-point between 0 and 3v3, is not that much different than the mid point of between 0 and 2v8, one can write the register. But this makes the I2C more reliable if using the 2v8 - which you use. 

And it might help to get rid of the level translator - saving you a bit of money. 

And I'm hoping it will save you that power drain as well.

- john


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.

Thank you for your reply. The function VL53L1_DataInit() is only available in the Full API (the complete version of the library) and is not present in the ULD and ULP libraries. Therefore, I am unable to modify VL53L1_DataInit() as you suggested. Due to the Flash limitations of my MCU, I cannot use the Full API—this library is simply too large and would also increase the CPU resource usage of the MCU (though I'm not entirely certain about this point).

Additionally, I don’t actually need the level-shifting chip. I kept it only because, for some reason, the TOF stopped working when I removed it, which is why I decided to retain the chip.