2020-11-10 07:27 AM
Hey guys and gals,
I have:
Issues I have encountered:
What I would need help or tips:
The code used is attached. Oh, and I used the STM32Cube IDE just fyi.
Output log>
VL53L1X Examples...
Setting XSHUT pin ON...
Waiting device to boot...
Reading device UID: 7555855411574540485
Setting Device Address to 0x52
Setting XSHUT pin OFF...
Setting XSHUT pin ON...
Waiting device to boot...
Reading device UID: 34401660361561757125
Setting Device Address to 0x53
Setting XSHUT pin OFF...
Setting XSHUT pin ON...
Waiting device to boot...
Reading device UID: 30870942771574540485
Setting Device Address to 0x54
Setting XSHUT pin OFF...
Setting XSHUT pin ON for ALL DEVICES...
XSHUT set for device UID: 536871480536871512
XSHUT set for device UID: 00
XSHUT set for device UID: 536871480536871512
Ranging loop starts
1342341161561363653 DISTANCE MODE: 1
1342341161561363653 DISTANCE MODE: 1
VL53LX_WaitDeviceBooted failed: error = -13
Thanks in advance,
Francisco
2020-11-12 08:00 AM
looking at this, I'm wonderiing if you are failing to sent the I2C addresses correctly.
Each I2C address requires a read and a write addresses.
As shipped, the I2c address is 0x29 shifted to the left by 1 bit - and the LSB is the write/read bit.
So 29 becomes 0x52 and this is the WRITE adderess. Setting the device to READ you get 0x53.
You changed your addresses to 52, 53 and 54.
And those are too close together. 0x52 and 0x53 are the same address - one write, one read.
I generally use 0x62, 0x72, 0x82... but you can use 0x54, 0x56, 0x58.. if you want.
But just use even numbers please.
This expains the issue of the same UID. Which ever sensor wins the arbitration - which is random - will return a value.
But you are talking to two sensors at once.
2020-11-14 05:45 PM
I changed the I2c addresses but still unable to read data through TeraTerm.Another thing I noticed the variable status is always 0
2020-11-16 04:35 AM
oh ok, I get it. I'll try and change the I2C addresses and see what I it returns.
EDIT: It is returning the -13 IO error when attempting to configure the first address to 0x62
VL53L1X Examples...
Setting XSHUT pin ON...
Waiting device to boot...
Reading device UID: 7555855411574540485
Setting Device Address to 0x62
VL53LX_SetDeviceAddress failed: error = -13
2020-11-16 04:38 AM
To me it is failing right after attempting to set the first device address to 0x62.
VL53L1X Examples...
Setting XSHUT pin ON...
Waiting device to boot...
Reading device UID: 7555855411574540485
Setting Device Address to 0x62
VL53LX_SetDeviceAddress failed: error = -13
2020-11-16 06:56 AM
I've had good luck with the following bit of code.
If you want the complete project go to ST.COM and search for 2D-Lidar.
The 2D-Lidar code uses 9 sensors.
uint16_t DevAddr[9] = {0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72};
for (i = 0; i < NumOfTOFSensors; i++)
{
Dev[i].I2cHandle = &I2C_HANDLE;
Dev[i].I2cDevAddr = 0x52;
TurnOnSensor(i);
HAL_Delay(5);
do {
status = VL53L1X_BootState(Dev[i], &temp);
HAL_Delay(5);
if (status) {
UART_Print("BootState returned bad status\n");
}
} while (temp != 3);
status += VL53L1X_SensorInit(Dev[i]); /* Initialize sensor */
status += VL53L1X_SetI2CAddress(Dev[i], DevAddr[i]); /* Change i2c address Left is now 0x62 and Dev1 */
CHECK_ERROR(status);
Dev[i].I2cDevAddr = DevAddr[i];
//status += VL53L1X_SensorInit(Dev[i]); /* Initialize sensor */
}
UART_Print("All Chips booted\n");
Perhaps your issue is the order. Checking for device booted and doing the SensorInit() first might help?
I used the UltraLite driver for this project. If you are using the Full driver the calls might be slightly different.