cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L0X returns 0x1FFFF (8191)

Hardwariano
Associate III

Hello, I'm using a VL53L0X and it returns 0x1FFFF depending on whether a function within "VL53L0X_StaticInit" is commented or not during initialization.

0690X00000D96y2QAB.png

If "VL53L0X_set_reference_spads" is commented, the sensor sends values (with a large offset). But, if "VL53L0X_set_reference_spads" is not commented, the sensor sends 0x1FFFF all the time.

Is this problem related to this other ST forum thread?

Regards

14 REPLIES 14
Julien NGUYEN
ST Employee

​Hi ,

We recommend you do not modify the basic functions of the driver.

To correct the offset error, you have to call the offset calibration function once the VL53L0X_StaticInit() function is called.

Thanks,

Julien


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Hardwariano
Associate III

Hi Julien, thanks for your answer.

Sorry, I think I explained it wrong.

My main problem is not the offset (I will use the function "VL53L0X_PerformOffsetCalibration" as you suggest to correct it).

My problem is within the "StaticInit" function. I don't want to modify the API that ST gives me, but the thing is that without modifiying the library, the sensor doesn't work (sends 0x1FFFF all the time). The VL53L0X only does something when I comment "VL53L0X_set_reference_spads" (I figured it out by trial and error).

That's why I asked if this problem was related to this other "initialization problem" thread. I'd like to know if it's an internal sensor problem or has to do with my program.

Regards

Julien NGUYEN
ST Employee

​Hi DDSG-1

The VL53L0X_set_reference_spads() function returns 0 from my side.

Could you please go inside the function and tell me where you get a returned status different of 0 for the first time.

Thanks,


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Hardwariano
Associate III

Hi Julien,

The function "VL53L0X_set_reference_spads" returns 0 all the time. This function sends the following frames:

  • 56 FF 01
  • 56 4F 00
  • 56 4E 2C
  • 56 FF 00
  • 56 B6 B4
  • 56 B0 00 F0 FF 01 00 00
  • 56 F0 /// 57 00 F0 FF 01 00 00

When I request distance measured, I get the following all the time:

  • 56 14 /// 57 21 06 BF 04 00 00 00 00 00 00 1F FF

The strange thing comes when I change the "local Status" variable to a "volatile local/global Status" variable (I only make this change in my code). In this case, sent frames are the same as before (56 FF 01, 56 4F 00, etc) except for the distance:

  • 56 14 /// 57 5B 06 1B 04 2C 1C 0B 30 00 12 00 5D
  • 56 14 /// 57 5B 06 18 04 3C 80 0B EE 00 0E 00 5E
  • 56 14 /// 57 5B 06 BF 04 01 C2 04 47 00 AC 01 09

As you can see, now the sensors detects my hand movements.

Any idea?

[EDIT] It seems that the weird "volatile trick" only works sometimes, so there must be something else I don't understand.

Anyway, the problem related to commenting or not commenting the function "VL53L0X_set_reference_spads" is the same: the sensor returns 0x1FFF if not commented, and real distances if commented.

Regards

John E KVAM
ST Employee

The only thing I can think of is you somehow got bad reference SPADs when you first calibrated and called the "VL53L0X_get_reference_spads", so when you set them after the next boot, you make a mess.

Is it possible?


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'
Hardwariano
Associate III

I'll take a look at the calibration process.

Thanks

Hardwariano
Associate III

Hello John.

I checked the program and the calibration process and now it works well. I'm not sure what happened but I didn't get the wrong measurement again. I think that SPAD calibration is now correct.

Now I have some doubts about SPAD calibration. Function "VL53L0X_perform_ref_spad_management()" returns two values: refSpadCount and isApertureSpads:

1) Are these parameters manufacturing dependant? I ask because my board has 3 VL53L0X and each one returns different values before and after VL53L0X_perform_ref_spad_management():

  • Sensor 0: After staticInit() --> refSpadCount = 5 /// isApertureSpads = 0

After VL53L0X_perform_ref_spad_management() --> refSpadCount = 12 /// isApertureSpads = 0

  • Sensor 1: After staticInit() --> refSpadCount = 6 /// isApertureSpads = 0

After VL53L0X_perform_ref_spad_management() --> refSpadCount = 10 /// isApertureSpads = 0

  • Sensor 2: After staticInit() --> refSpadCount = 17 /// isApertureSpads = 1

After VL53L0X_perform_ref_spad_management() --> refSpadCount = 11 /// isApertureSpads = 0

2) ¿Could you please explain briefly what exactly those parameters are? I get an idea of what refSpadCount means, but I can't understand the meaning of isApertureSpads and why some sensors return 0 and others return 1 after staticInit().

I also can't understand why after VL53L0X_perform_ref_spad_management() they all have similar values (12,10,11 and 0,0,0)

Regards.

John E KVAM
ST Employee

To combat getting too much light in the sensor, some SPADS are covered with an Aperture to limit the amount of light that can get in. This is why we return the SPAD count as a floating point number.

The RefSpad is a region of the photon detect array that we use to determine when the laser is turned on. There is a fairly long time from the time we put power to the laser and when the laser starts emitting.

The calibration establishes which detector elements get triggered when the laser comes on and how many. As the geometry of the chip changes during the reflow process, we need to calibrate for this geometry. And if the light shines on some of the occluded 'aperture' SPADS, we need to use more.

Before you calibrate you get our factory calibration. After you calibrate you get the changes induced by the reflow process.

  • john

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'

Hi,

I have the exact same behaviour. Did you ever figure out what the problem was?