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?
VL53L0X Error: -5 / Failed to boot first VL53L0X
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
How are you doing this? Here is ST's ap note on the subject:I assign each sensor its own address.
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
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
I'll take Adafruit's example. That's why I don't need a muxer (hope so)How are you doing this?
https://github.com/adafruit/Adafruit_VL ... 53l0x_dual
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.The settings are volatile, so you need to take that into account.
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
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
if(!lox1.begin(LOX1_ADDRESS, true)) {
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
Did you read my first post or the headline? (scnr)Try turning that out and see if prints out anything useful.
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
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
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?
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?
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
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:It seems like maybe the sensor isn't fully resetting during the sleep cycle maybe?
Code: Select all
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);
}
}
And this is the loop:
Code: Select all
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);
}
For this example, I do not use the sleep modeDo you have any kind of delays between coming out of sleep and trying to re-init the VL53L0X?
Do you have any other ideas about what can go wrong?
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
What is the behavior for the loop above? Works the first time through but not on other passes?
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
Exactly.What is the behavior for the loop above? Works the first time through but not on other passes?
If I comment out either of these two lines in the loop, then it works too.
Code: Select all
digitalWrite(SHT_LOX1, LOW);
digitalWrite(SHT_LOX2, LOW);
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
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?
- loeffma
- Posts: 6
- Joined: Tue Jul 20, 2021 1:44 pm
Re: VL53L0X Error: -5 / Failed to boot first VL53L0X
Yes and no. To reset the VL53L0X, the XShut pin must be LOW. This is how the initialization starts.Maybe the SHT_LOX pins need to be HIGH when the power supply is enabled?
Code: Select all
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);
...
Commenting out is exactly what I don't want to do, otherwise my energy consumption is too high!That's why commenting them out in the loop gets it working?
Please be positive and constructive with your questions and comments.