cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X standby power consumption too high in the ULP driver

qqzlqqzlqqzl
Associate III

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 */
}

 

11 REPLIES 11
qqzlqqzlqqzl
Associate III

This image shows the current curve during ranging. The configuration is a 50ms timing budget, a 50ms inter-measurement period, and long-range mode.

qqzlqqzlqqzl_0-1756093314573.png

By tracing the function calls, I found that VL53L1_ClearInterruptAndStartMeasurement is already called within the VL53L1CB_GetDistance function. The ToF driver and the demo program were generated using CubeMX software.

As a side note, there is a significant difference in power consumption between different library versions.

John_Kvam
Senior

The CB code had an issue and it was decided to fix the issue with a patch to the code on the sensor. But that means that one has to keep the sensor alive enough to not lose the memory. And that is why the histogram parts do not go into their lowest power setting.

However, that patch is not used in the non-histogram parts. And it should be a lot lower than the 17ma shown in your plot. 

And especially the ULP driver should get down to zero. 

Could it be that you are measuring something in addition to the power used by the sensor? When I was doing this, I inadvertently was measuring some pull-up voltage. (I blame my software background.) 

but if you power consumption is too high, ensure the interrupt is clear, and the I2C lines are both high. It's really all I can think of. 

- john

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.