VL53L0X测试一

一、编译源码

编译vl53l0x_test.c生成vl53l0x_test,然后将vl53l0x_test上传到硬件终端。

程序中已设定传感器工作在CONTINUOUS_TIMED_RANGING模式。

二、调试

1、测量距离

先执行./vl53l0x_test -o进行校准

# ./vl53l0x_test -o
[ 3759.554521] Call of VL53L0X_DataInit
[ 3759.564987] VL53L0X_GetDeviceInfo:
[ 3759.575923] Device Name : VL53L0X ES1 or later
[ 3759.580550] Device Type : VL53L0X
[ 3759.583970] Device ID : VL5
[ 3759.586849] Product type: 238
[ 3759.589907] ProductRevisionMajor : 1
[ 3759.593607] ProductRevisionMinor : 1
[ 3759.597294] Call of VL53L0X_StaticInit
[ 3759.625375] Call of VL53L0X_PerformRefCalibration
[ 3759.651443] Call of VL53L0X_PerformRefSpadManagement
[ 3759.727228] Call of VL53L0X_SetDeviceMode
[ 3760.829411] Offset calibration:1
get offset 0 micrometer===
get VhvSettings is 32 ===
get PhaseCas is 1 ===
get SpadCount is 4 ===
get IsApertureSpads is 0 ===

再执行./vl53l0x_test测量距离

# ./vl53l0x_test
[ 3820.089948] Call of VL53L0X_DataInit
[ 3820.100097] VL53L0X_GetDeviceInfo:
[ 3820.111196] Device Name : VL53L0X ES1 or later
[ 3820.115786] Device Type : VL53L0X
[ 3820.119205] Device ID : VL5
[ 3820.122100] Product type: 238
[ 3820.125160] ProductRevisionMajor : 1
[ 3820.128847] ProductRevisionMinor : 1
[ 3820.132544] Call of VL53L0X_StaticInit
[ 3820.160884] Call of VL53L0X_PerformRefCalibration
[ 3820.186952] Call of VL53L0X_PerformRefSpadManagement
[ 3820.263061] Call of VL53L0X_SetDeviceMode
[ 3820.268559] DeviceMode:0x0, interMeasurems:30==
[ 3820.273648] Configure Long Ranging
[ 3820.277307] Set Timing Budget = 26000
^CRange:2139, Error:0, SigRate_mcps:  22528, AmbRate_mcps:  12800

2、测试low mode中断门限模式

例如设置当距离≤300mm时才产生中断,执行./vl53l0x_test -L 300

# ./vl53l0x_test -L 300
Configuring Low threshold = 300, High threhold = 0[ 4009.689413] Call of VL53L0X_DataInit

[ 4009.701821] VL53L0X_GetDeviceInfo:
[ 4009.712938] Device Name : VL53L0X ES1 or later
[ 4009.717527] Device Type : VL53L0X
[ 4009.720962] Device ID : VL5
[ 4009.723844] Product type: 238
[ 4009.726903] ProductRevisionMajor : 1
[ 4009.730599] ProductRevisionMinor : 1
[ 4009.734288] Call of VL53L0X_StaticInit
[ 4009.762612] Call of VL53L0X_PerformRefCalibration
[ 4009.788681] Call of VL53L0X_PerformRefSpadManagement
[ 4009.864785] Call of VL53L0X_SetDeviceMode
[ 4009.870689] DeviceMode:0x3, interMeasurems:30==
[ 4009.875758] Configure Long Ranging
[ 4009.879417] Set Timing Budget = 26000
^CRange: 265, Error:0, SigRate_mcps: 202240, AmbRate_mcps:  13824

只有当300mm内有物体时才会输出距离。

你可能感兴趣的:(君正X2000,VL53L0X)