Sensor Multizona
Sensor Multizona
Sensor Multizona
User manual
Introduction
The purpose of this user manual is to explain how to handle the VL53L5CX Time-of-Flight (ToF) sensor, using the ultra lite driver
(ULD) API. It describes the main functions to program the device, the calibrations, and the output results.
The VL53L5CX is a state of the art, ToF, multizone ranging sensor enhancing the ST FlightSense product family. Housed in
a miniature reflowable package, it integrates a SPAD array, physical infrared filters, and diffractive optical elements (DOE) to
achieve the best ranging performance in various ambient lighting conditions with a range of cover glass materials.
Multizone distance measurements are possible up to 8x8 zones with a wide 63° diagonal field of view (FoV) which can be
reduced by software. Each zone of the VL53L5CX measures the distance of the target up to 4 meters, at a maximum frequency
of 60 Hz.
Thanks to ST Histogram patented algorithms, the VL53L5CX is able to detect different objects within the FoV. The Histogram
also provides immunity to cover glass crosstalk beyond 60 cm.
References
VL53L5CX datasheet (DS13754).
Acronym/abbreviation Definition
2 Functional description
To allow a device to have its I2C address changed without affecting others on the I2C bus, it is important to
disable the I2C communication of the devices not being changed. The procedure is the following one :
1. Power up the system as normal.
2. Pull down the LPn pin of the device that will not have its address changed.
3. Pull up the LPn pin of the device that has the I2C address changed.
4. Program the I2C address to the device using function set_i2c_address() function.
5. Pull up the LPn pin of the device not being reprogrammed.
All devices should now be available on the I2C bus. Repeat the above steps for all the VL53L5CX devices in the
system that require a new I2C address.
The user also needs to implement two files located in the /Platform folder. The proposed platform is an empty
shell, and must be filled with dedicated functions.
Note: Platform.h file contains mandatory macros to use the ULD. All the file content is mandatory to correctly use the
ULD.
Note: Increasing the number of samples increases the accuracy, but it also increases the time for calibration. The time
relative to the number of samples is linear, and values follow the approximate timeout:
• 1 sample ≈ 1 second
• 4 samples ≈ 2.5 seconds
• 16 samples ≈ 8.5 seconds
The calibration is performed using function vl53l5cx_calibrate_xtalk(). This function can be used at any time.
However, the sensor must be initialized first. The following figure represents the Xtalk calibration flow.
4 Available features
The VL53L5CX ULD API includes several functions which allow the user to tune the sensor, depending on the
usecase. All functions available for the driver are described in the following sections.
4.1 Initialization
Initialization must be done before using the VL53L5CX sensor. This operation requires the user to:
1. Power on the sensor (VDDIO, AVDD, LPn pins set to High, and pin I2C_RST set to 0)
2. Call the function vl53l5cx_init(). The function copies the firmware (~84 kbytes) to the module by loading the
code over the I2C interface and performing a boot routine to complete the initialization.
4.3 Resolution
The resolution corresponds to the number of available zones. The VL53L5CX sensor has two possible
resolutions: 4x4 (16 zones) and 8x8 (64 zones). By default the sensor is programmed in 4x4.
The function vl53l5cx_set_resolution() allows the user to change the resolution. As the ranging frequency
depends on the resolution, this function must be used before updating the ranging frequency. Moreover, changing
the resolution also increases the traffic size on the I2C bus when results are read.
4x4 1 60
8x8 1 15
Ranging frequency can be updated using function vl53l5cx_set_ranging_frequency_hz(). By default, the ranging
frequency is set to 1 Hz.
The sum of all integration times + 1 ms overhead must be lower than the measurement period. Otherwise the
ranging period is automatically increased.
4.8 Sharpener
The signal returned from a target is not a clean pulse with sharp edges. The edges slope away and may affect the
distances reported in adjacent zones. The sharpener is used to remove some or all of the signal caused by veiling
glare.
The example shown in the following figure represents a close target at 100 mm centered in the FoV, and another
target, further behind at 500 mm. Depending on the sharpener value, the close target may appear in more zones
than the real one.
Sharpener can be changed using function vl53l5cx_set_sharpener_percent(). The allowed values are between
0 % and 99 %. The default value is 5 %.
5 Ranging results
Note: For several elements (signal per spad, sigma, …) access to data is different if user has programmed more than
1 target per zone (see Section 4.10 Multiple targets per zone). See example codes for more information.
Consequently, the fields are not be declared in the results structure, and the data is not transferred to the host.
The RAM size and I2C size are reduced.
To ensure data consistency, ST recommends to always keep ‘number of target detected’ and ‘target status’
enabled. It allows filtering the measurements depending of the target status (refer to Section 5.5 Results
interpretation).
To have consistent data, the user needs to filter invalid target status. To give a confidence rating, a target with
status 5 is considered as 100 % valid. A status of 6 or 9 can be considered with a confidence value of 50 %. All
other statuses are below 50 % confidence level.
0 No error
User programmed an incorrect setting (unknown resolution, ranging frequency too
127
high, …)
255 Major error. Usually a timeout error, due to an I2C error.
other Combination of multiple errors described above
Note: More error codes can be implemented by the host using the platform files.
Revision history
Table 6. Document revision history
Contents
1 Acronyms and abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 System overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Effective orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Schematics and I2C configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Package content and data flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Driver architecture and content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Calibration flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 Ranging flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Available features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
4.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2 Sensor reset management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.4 Ranging frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.5 Ranging mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.6 Integration time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.7 Power modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.8 Sharpener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.9 Target order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.10 Multiple targets per zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.11 Xtalk margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.12 Detection thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.13 Motion indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Ranging results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
5.1 Available data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2 Customize output selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.3 Getting ranging results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.4 Using raw firmware format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.5 Results interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.6 Driver errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16