Using System.sleep(SLEEP_MODE_DEEP) w/ Hybrid-0.9.0

boron
Tags: #<Tag:0x00007f1ca3af45d0>

#1

Hello All,

This might be a silly question but how do I wake up the BoronLTE from Deep-Sleep?
On the Electron3G I use the time argument passed to System.sleep(SLEEP_MODE_DEEP) but the doc’s for BoronLTE mention the following:

The Gen 3 devices (Argon, Boron, Xenon) can only wake from SLEEP_MODE_DEEP by rising D8. It’s not possible to exit SLEEP_MODE_DEEP based on time because the clock does not run in standby sleep mode on the nRF52.

Does that mean I need external circuit with timer that triggers D8 by setting it High after the desired sleep time? Thanks again for any help!


#2

Yes - But the other sleep mode (System.sleep(pin, edge, timout)) doesn’t consume that much more power than deep sleep on the nRF based devices.
So it depends on your prime target ease of implementation vs. “marginal” power preservation.


#3

Oh that’ll do , can you link me to the reference in docs to System.sleep(pin, edge, timout) please?
Having a hard timing finding it in the reference docs.


#4

It’s actually there where deep sleep is documented too
https://docs.particle.io/reference/device-os/firmware/boron/#sleep-sleep-

And the doc’s search feature does help :wink:

And at the top of this forum page you have a link to the DOCS


#5

you’re awesome!
If we ever cross paths in the bay area, I’d like to buy you a brew! :slight_smile:


#6

Quick FollowUp Question(s): Has anything changed recently that may have broken this functionality? The following code no longer seems to work (the device doesn’t wakeup after 60 seconds of sleep).

FW: hybrid-0.9.0-boron.bin

void sleep() {
  Serial.println("start of cleanupsleep()");
  Serial.println("end of cleanupsleep()");
  System.sleep(D8,RISING,60);
}

void setup() {
sleep();
}

void lopp() {
}

Thanks for your help!


#7

Are you sure it doesn’t wake or does it just go back to sleep too quickly.
Serial.println() needs some time to actually push the data out the USB interface.
Try adding a delay(100); before the sleep call.


#8

Oh there’s a lot more code & functions I just didn’t put any other code there for simplicity.
So it def. doesn’t wakeup because none of the other functions are executed.

Another thing I read in the docs: “The device will not reset before going into stop mode so all the application variables are preserved after waking up from this mode.”

The device does reset after the time interval runs out and starts executing Application FW fromstarting with void setup(){}, right?


#9

The sleep you defined is STOP mode sleep which will NOT reset after waking. Instead, execution continues at the instruction following the sleep() command. Only STANDBY aka deep sleep causes a reset of the device after waking.


#10

The behavior makes sense now, Thank you.


#11

so I put in a call to setup() after System.sleep(D8,RISING,60) but it still doesn’t seem to come back from sleep, any suggestions? I’ve also tried putting in a call to System.reset() after System.sleep(D8,RISING,60) and still nothing seems to be happening once it goes to sleep…