re-enter deep sleep in esp_wake_deep_sleep()

rummyr
Posts: 5
Joined: Thu Mar 22, 2018 6:37 am

re-enter deep sleep in esp_wake_deep_sleep()

Postby rummyr » Mon Sep 03, 2018 4:33 pm

Apologies if this has already been asked.
Is it possible to re-enter deep sleep from within esp_wake_deep_sleep()?

Obviously I've tried, but if I call

Code: Select all

esp_sleep_enable_timer_wakeup(###)
without even trying to call

Code: Select all

esp_deep_sleep_start()
I get an

Code: Select all

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
Am I just being stupid and this isn't accessible from within an RTC_IRAM_ATTR function?
or is it more complex?
or is it a bug?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: re-enter deep sleep in esp_wake_deep_sleep()

Postby WiFive » Tue Sep 04, 2018 12:20 am

The wake stub code can only call functions implemented in ROM or loaded into RTC Fast Memory
https://docs.espressif.com/projects/esp ... -stub.html

rummyr
Posts: 5
Joined: Thu Mar 22, 2018 6:37 am

Re: re-enter deep sleep in esp_wake_deep_sleep()

Postby rummyr » Thu Sep 06, 2018 6:20 am

Still trying to get a handle on this .. hope people don't mind me adding findings here

ROM functions can be found in
https://github.com/espressif/esp-idf/tr ... nclude/rom

sleep related functions can be found in
https://github.com/espressif/esp-idf/bl ... ep_modes.c

So I guess it's going to be a case of copying the necessary code from sleep_modes.c, or maybe delving into ULP!

*deleted a long section based on me thinking IRAM was the same as RTC_IRAM*

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

Re: re-enter deep sleep in esp_wake_deep_sleep()

Postby boarchuz » Sat Sep 08, 2018 1:40 pm

There's sample code that does exactly this:

https://gist.github.com/igrr/54f7fbe051 ... d7fbecfeab

rummyr
Posts: 5
Joined: Thu Mar 22, 2018 6:37 am

Re: re-enter deep sleep in esp_wake_deep_sleep()

Postby rummyr » Tue Oct 23, 2018 12:27 pm

That code was brill ... its a PITA to try to find exactly what you can and can't call though, you have to poke through the source looking for the IRAM tag.

For what it's worth in case anyone cares.

I'm finding that it takes around 1mSec from when I see the current begins to ramp up before my wake_stub code raises an IO line high.

Who is online

Users browsing this forum: No registered users and 82 guests