VL53L0X long range mode not working
Hi,
I am currently actively debugging and working with the sensor and it shows correct measurement data when i set the profile to 'Long range' example (settings from the 'um2039' User manual).

however the sensor response for RangeDMaxMilliMeter: always show a value around 1200 which should be around 2000, is there another settings which i need to do before the profile is actively set to long range?
Measurement data is now also correctly measured until about 1200mm but higher results in invalid measurements.
below are my settings as they are performed in the code:
MyDevice.I2cDevAddr = 0x52;
MyDevice.comms_type = 1; // 1 should equal I2C
MyDevice.comms_speed_khz = 100;
MyDevice.hi2c = hi2c;
VL53L0X_DEV = &MyDevice;
if (VL53L0X_DataInit(VL53L0X_DEV) != VL53L0X_ERROR_NONE)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
if (VL53L0X_StaticInit(VL53L0X_DEV) != VL53L0X_ERROR_NONE)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Calibration steps
if (calibration->memory_valid != 0)
{
// SPADs calibration
VL53L0X_Error calibration_step = VL53L0X_SetReferenceSpads(VL53L0X_DEV,
calibration->refSpadCount,
calibration->isApertureSpads);
if (calibration_step == VL53L0X_ERROR_CALIBRATION_WARNING)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_TIMEOUT;
}
else if (calibration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Temperature calibration
calibration_step = VL53L0X_SetRefCalibration(VL53L0X_DEV,
calibration->pVhvSettings,
calibration->pPhaseCal);
if (calibration_step == VL53L0X_ERROR_CALIBRATION_WARNING)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_TIMEOUT;
}
else if (calibration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Offset calibration
calibration_step = VL53L0X_SetOffsetCalibrationDataMicroMeter(VL53L0X_DEV,
calibration->pOffsetMicroMeter);
if (calibration_step == VL53L0X_ERROR_CALIBRATION_WARNING)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_TIMEOUT;
}
else if (calibration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Crosstalk calibration and enabling
calibration_step = VL53L0X_SetXTalkCompensationRateMegaCps(VL53L0X_DEV,
calibration->XTalkCompensationRateMegaCps);
if (calibration_step == VL53L0X_ERROR_CALIBRATION_WARNING)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_TIMEOUT;
}
else if (calibration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
calibration_step = VL53L0X_SetXTalkCompensationEnable(VL53L0X_DEV, 1);
if (calibration_step == VL53L0X_ERROR_CALIBRATION_WARNING)
{
g_tof_state = tof_sensor_reset_sensor;
return HAL_TIMEOUT;
}
else if (calibration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Configuration steps (!!!!!!!!!!!! Long range mode !!!!!!!)
// Limit check value >> 1
VL53L0X_Error configuration_step = VL53L0X_SetLimitCheckValue(VL53L0X_DEV,
VL53L0X_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE,
(FixPoint1616_t)(0.1 *65536));
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Limit check value >> 2
configuration_step = VL53L0X_SetLimitCheckValue(VL53L0X_DEV,
VL53L0X_CHECKENABLE_SIGMA_FINAL_RANGE,
(FixPoint1616_t)(60 *65536));
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Measurement timing budget
configuration_step = VL53L0X_SetMeasurementTimingBudgetMicroSeconds( VL53L0X_DEV, 33000);
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// VCEL pulse period 1
configuration_step = VL53L0X_SetVcselPulsePeriod(VL53L0X_DEV,
VL53L0X_VCSEL_PERIOD_PRE_RANGE, 18);
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// VCEL pulse period 2
configuration_step = VL53L0X_SetVcselPulsePeriod(VL53L0X_DEV,
VL53L0X_VCSEL_PERIOD_FINAL_RANGE, 14);
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}
// Device mode
configuration_step = VL53L0X_SetDeviceMode( VL53L0X_DEV, VL53L0X_DEVICEMODE_SINGLE_RANGING);
if (configuration_step != VL53L0X_ERROR_NONE)
{
// Some error
g_tof_state = tof_sensor_reset_sensor;
return HAL_ERROR;
}