0

VL53L0X Error: -5 / Failed to boot first VL53L0X
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Tue Jul 20, 2021 2:02 pm

Hi Folks.

I have a very specific question / application about the VL53L0X:
I am using 2 VL53L0X at the same time in one application. I assign each sensor its own address. This also works quite well with the examples from Adafruit. However, the application is battery operated and I only measure every 15 minutes. In between, the uC (LoRaWAN Heltec cubecell) is in deep sleep mode. During this time I would like to remove the power supply from the sensors and set the XShut pin to low (otherwise the sensor partly needs power) in order to achieve maximum battery life.
However, after waking up and initializing (reassigning addresses, etc.) of the sensors (with Adafruit this is possible via the "setID" function) it no longer works. The sensors go into error. Only a restart / reset will get everything running again.
After deep sleep I switch on the power supply for the sensors and wait until it is stable. Then I do the initialization (setID) of the sensors. After that I get this error-message via debug:

VL53L0X Info:
Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: 
Rev Major: 1, Minor: 15
Error expected cut 1.1 but found 1,15
VL53L0X Error: -5
Failed to boot first VL53L0X


What can be the problem?

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by adafruit_support_carter on Tue Jul 20, 2021 3:34 pm

I assign each sensor its own address.

How are you doing this? Here is ST's ap note on the subject:
https://www.st.com/resource/en/applicat ... ronics.pdf
The settings are volatile, so you need to take that into account.

You may also want to consider using an I2C muxer instead:
https://learn.adafruit.com/adafruit-tca ... r-breakout

adafruit_support_carter
 
Posts: 20567
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Wed Jul 21, 2021 6:48 am

How are you doing this?


I'll take Adafruit's example. That's why I don't need a muxer (hope so)
https://github.com/adafruit/Adafruit_VL ... 53l0x_dual

The settings are volatile, so you need to take that into account.


Yes, I know that some of the settings are volatile. Therefore I reinitialize the sensors via the "setID" function, as in the linked example, after switching the power supply off and on again.

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by adafruit_support_carter on Wed Jul 21, 2021 7:41 pm

The second parameter to begin() is a bool you can use to enable some debug output. Try turning that out and see if prints out anything useful. Example (do this for both sensors):
Code: Select all | TOGGLE FULL SIZE
  if(!lox1.begin(LOX1_ADDRESS, true)) {

adafruit_support_carter
 
Posts: 20567
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Thu Jul 22, 2021 6:00 am

Try turning that out and see if prints out anything useful.

Did you read my first post or the headline? (scnr)

I have already turned on debug as you described. You can read the output of the debug in the first post.
Unfortunately I don't now what to do with the error code. But Adafruit should know what that means, right? Because it´s an Adafruit library.

Regards

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by adafruit_support_carter on Thu Jul 22, 2021 12:14 pm

It seems like maybe the sensor isn't fully resetting during the sleep cycle maybe? For some reason it's not getting the expected product revision numbers after coming out of sleep.
https://github.com/adafruit/Adafruit_VL ... X.cpp#L112

Do you have any kind of delays between coming out of sleep and trying to re-init the VL53L0X?

adafruit_support_carter
 
Posts: 20567
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Thu Jul 22, 2021 4:03 pm

It seems like maybe the sensor isn't fully resetting during the sleep cycle maybe?

Yes, I do a reset after switch on the Power Supply of the sensors. Look, this is the initing function for the sensors after switch off the power supply for the sensors:

Code: Select all | TOGGLE FULL SIZE
 void setID() {
   
  //switch on the Power Supply
  digitalWrite(Vext,LOW);
  delay(100);
     
  // all reset
  digitalWrite(SHT_LOX1, LOW);   
  digitalWrite(SHT_LOX2, LOW);
  delay(10);
   
  // all unreset
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);

  // activating LOX1 and reseting LOX2
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, LOW);
  delay(10); 

  // initing LOX1
  if(!lox1.begin(LOX1_ADDRESS,true)) {
    Serial.println(F("Failed to boot first VL53L0X"));
    while(1);
  }
  delay(10);

  // activating LOX2
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);

  //initing LOX2
  if(!lox2.begin(LOX2_ADDRESS,true)) {
    Serial.println(F("Failed to boot second VL53L0X"));
    while(1);
  }
}


The first thing after switch on the power supply is a reset of all sensors by putting the XSHUT to Low.

And this is the loop:
Code: Select all | TOGGLE FULL SIZE
void loop() {
  //initing Sensors
  setID();
   
  //read sensor values 
  read_dual_sensors();
 
  //switch off the Power Supply an switch the XShut-Pins to Low to save energie
  digitalWrite(Vext,HIGH);   
  digitalWrite(SHT_LOX1, LOW);   
  digitalWrite(SHT_LOX2, LOW);
  delay(10000);
}



Do you have any kind of delays between coming out of sleep and trying to re-init the VL53L0X?

For this example, I do not use the sleep mode

Do you have any other ideas about what can go wrong?

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by adafruit_support_carter on Thu Jul 22, 2021 7:02 pm

What is the behavior for the loop above? Works the first time through but not on other passes?

adafruit_support_carter
 
Posts: 20567
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Fri Jul 23, 2021 4:43 am

What is the behavior for the loop above? Works the first time through but not on other passes?

Exactly.

If I comment out either of these two lines in the loop, then it works too.

Code: Select all | TOGGLE FULL SIZE
  digitalWrite(SHT_LOX1, LOW);   
  digitalWrite(SHT_LOX2, LOW);


... and I don't understand where the problem is supposed to be.

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by adafruit_support_carter on Fri Jul 23, 2021 3:33 pm

Maybe the SHT_LOX pins need to be HIGH when the power supply is enabled? That's why commenting them out in the loop gets it working?

adafruit_support_carter
 
Posts: 20567
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Error: -5 / Failed to boot first VL53L0X

by loeffma on Sun Jul 25, 2021 3:04 pm

Maybe the SHT_LOX pins need to be HIGH when the power supply is enabled?

Yes and no. To reset the VL53L0X, the XShut pin must be LOW. This is how the initialization starts.

Code: Select all | TOGGLE FULL SIZE
 void setID() {
   
  //switch on the Power Supply
  digitalWrite(Vext,LOW);
  delay(100);
     
  // all reset
  digitalWrite(SHT_LOX1, LOW);   
  digitalWrite(SHT_LOX2, LOW);
  delay(10);
   
  // all unreset
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);

...

That's what I don't understand why the initialization doesn't seem to work after power up.

That's why commenting them out in the loop gets it working?

Commenting out is exactly what I don't want to do, otherwise my energy consumption is too high!

loeffma
 
Posts: 6
Joined: Tue Jul 20, 2021 1:44 pm

Please be positive and constructive with your questions and comments.