cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable 3 multi-ranging sensors by polling mode on x-NUCLEO-53L1A1???

leo su
Associate II
Posted on March 26, 2018 at 06:07

Description:

We currently implement 3 multi-ranging sensors on  x-NUCLEO-53L1A1 by polling mode,

implementing in AutonomousLowPowerRangingTest(), 

There are some problems found that when I try to change sensor I2C device address to 

left = 0x54, center = 0x56, right = 0x58. SW will get error return code as -15 (VL53L1_ERROR_DIVISION_BY_ZERO).

but if I try to enable ONLY ONE sensor by addr = 0x52 (default), it can be working without problem.

So my question is, do 3 sensors share same I2C as 0x52 and if so, how to get each sensor values?

I attach my code for reference

== start

void AutonomousLowPowerRangingTest(void)

{

static VL53L1_RangingMeasurementData_t RangingData;

uint8_t byteData;

printf('Autonomous Ranging Test\n');

status = XNUCLEO53L1A1_ResetId(1, 0); // Reset ToF sensor

HAL_Delay(2);

status = XNUCLEO53L1A1_ResetId(1, 1); // Reset ToF sensor

HAL_Delay(2);

//status = VL53L1_SetDeviceAddress(Dev, 0x56);

//HAL_Delay(2);

status = VL53L1_WaitDeviceBooted(Dev);

HAL_Delay(2);

Dev->I2cDevAddr = 0x56;

status = VL53L1_DataInit(Dev); -> IT FAILS here by -15

status = VL53L1_StaticInit(Dev);

status = VL53L1_SetDistanceMode(Dev, VL53L1_DISTANCEMODE_LONG);

status = VL53L1_SetMeasurementTimingBudgetMicroSeconds(Dev, 50000);

status = VL53L1_SetInterMeasurementPeriodMilliSeconds(Dev, 500);

status = VL53L1_StartMeasurement(Dev);

status = XNUCLEO53L1A1_ResetId(0, 1); // Reset ToF sensor

HAL_Delay(2);

status = VL53L1_WaitDeviceBooted(DevL);

status = VL53L1_SetDeviceAddress(DevL, 0x54);

HAL_Delay(2);

Dev->I2cDevAddr = 0x54;

status = VL53L1_DataInit(DevL); 

-> IT FAILS here by -15

status = VL53L1_StaticInit(DevL);

status = VL53L1_SetDistanceMode(DevL, VL53L1_DISTANCEMODE_LONG);

status = VL53L1_SetMeasurementTimingBudgetMicroSeconds(DevL, 50000);

status = VL53L1_SetInterMeasurementPeriodMilliSeconds(DevL, 500);

status = VL53L1_StartMeasurement(DevL);

status = XNUCLEO53L1A1_ResetId(2, 1); // Reset ToF sensor

HAL_Delay(2);

status = VL53L1_WaitDeviceBooted(DevR);

status = VL53L1_SetDeviceAddress(DevR, 0x58);

HAL_Delay(2);

Dev->I2cDevAddr = 0x58;

status = VL53L1_DataInit(DevR); 

-> IT FAILS here by -15

status = VL53L1_StaticInit(DevR);

status = VL53L1_SetDistanceMode(DevR, VL53L1_DISTANCEMODE_LONG);

status = VL53L1_SetMeasurementTimingBudgetMicroSeconds(DevR, 50000);

status = VL53L1_SetInterMeasurementPeriodMilliSeconds(DevR, 500);

status = VL53L1_StartMeasurement(DevR);

== end

1 REPLY 1

Sorry, bumping old zombie unanswered questions off my feed

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..