Page 1 of 1

Wake Up from GPIO

Posted: Tue Dec 13, 2016 2:50 pm
by Alexis
Hello,

Is it possible to Wake UP the ESP32 from a GPIO today ?
I've tried to simply use: gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) but it does not seem to work. When the ESP32 is in Deep Sleep, it's not possible to wake it up from the GPIO, only by the timer.
Am I missing anything there ?

I'm also wondering if it was possible to make the ESP32 sleep without any Wake Up timeout, but only with a Wake Up on the GPIO ?
Regarding the function: esp_deep_sleep(uint64_t time_in_us) it seems, I've no choice to choose a certain Sleeping time, right ?

Re: Wake Up from GPIO

Posted: Wed Dec 14, 2016 2:27 am
by ESP_igrr
FYI, I'm working on other deep sleep wakeup modes now, so the following functions will be added soon-ish. These include two modes of GPIO wakeup.

Code: Select all

esp_err_t esp_deep_sleep_enable_timer_wakeup(uint64_t time_in_us);
esp_err_t esp_deep_sleep_enable_ulp_wakeup();
esp_err_t esp_deep_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level);
esp_err_t esp_deep_sleep_enable_ext1_wakeup(uint64_t mask, esp_ext1_wakeup_mode_t mode);
esp_err_t esp_deep_sleep_pd_config(esp_deep_sleep_pd_domain_t domain,
                                   esp_deep_sleep_pd_option_t option);
void esp_deep_sleep_start() __attribute__((noreturn));

Re: Wake Up from GPIO

Posted: Wed Dec 14, 2016 2:28 am
by ESP_igrr
You can also do this with the current version if you modify some source files. See this wiki for an example:

http://wiki.jackslab.org/ESP32_RTC_External_Wakeup

Re: Wake Up from GPIO

Posted: Fri Dec 16, 2016 3:46 am
by Alexis
Ok, thanks for the informations !

About the deep sleep mode, when I call the function: esp_deep_sleep() the module should be in Deep Sleep and the consumption should be, as announced in the Datasheet, about 0.1 to 0.2 mA, right ? Or should I do some other setup by myself while going in sleep mode ?

Today, when I measure it, the consumption is more about 1 ma on the ESP32 while in Deep Sleep.

Re: Wake Up from GPIO

Posted: Sat Jan 07, 2017 8:48 am
by Alexis
Hello,

Since the update of the SDK, I'm able to set the ESP32 in Deep Sleep and wake it up with External Wake Up.
So my initial issue is solved.

I'm now wondering what the consumpion I can really expect from the ESP32 at this stage.

According to the Datasheet, I could reach a consumption of 2.5 µA in hibernate mode:

Light-sleep : 0.8 mA
Deep-sleep
The ULP co-processor is powered on : 0.15 mA
ULP sensor-monitored pattern : 25 µA @1% duty
RTC timer + RTC memory : 10 µA
Hibernation RTC timer only : 2.5 µA

But what's exactly the Hibernation ?
Does it correspond to the Power Down of each Power Domain ?
If so, it should be achieve by calling:
esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH | ESP_PD_DOMAIN_RTC_SLOW_MEM | ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
esp_deep_sleep_start();
Then, if I want to be able to Wake Up the ESP32 on external wake up, and be able to save data in the RTC Memory, I assume I should call:
esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH | ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
esp_deep_sleep_start();
Then how much the ESP32 should consume ?
Should I consider the ULP co-processor is powered (0.15 mA) on and the RTC Memory (10 µA) which makes something like 0.16 mA ?

Can I already rely on the values given in the Datasheet or this part of the ESP32 is not totally developped yet ?
I've done some measurements by myself but it seems I cannot go below 0.2 mA.
So if you have any values already measured for comparison, it would be helpful.

Cheers,

Alexis

Re: Wake Up from GPIO

Posted: Tue Jan 10, 2017 12:12 am
by andrew_p
Alexis wrote:I'm able to set the ESP32 in Deep Sleep and wake it up with External Wake Up.
Hi Alexis,
is there any chance you can share deep sleep / external wake up example code?

Re: Wake Up from GPIO

Posted: Thu Aug 03, 2017 6:26 am
by rajkumar patel
Alexis wrote:
ULP sensor-monitored pattern : 25 µA @1% duty
has anyone got clarity on this?
Alexis wrote: But what's exactly the Hibernation ?
Does it correspond to the Power Down of each Power Domain ?
how could i achieve hibernation exactly?

whenever i try to use selection of the options
as,

esp_deep_sleep_pd_config(ESP_PD_DOMAIN_MAX, ESP_PD_OPTION_OFF)
or
esp_deep_sleep_pd_config(ESP_PD_DOMAIN_MAX, ESP_PD_OPTION_AUTO)

these configuration calls are returning error code.

i'm unable to understand the significance of providing this config option.

i'm putting the esp in deep sleep and then waking it up using a rtc gpio interrupt and then running a wakeup stub which is stored in fast memory(if i'm guessing it correctly) as i've used RTC_DATA_ATTR for storage.

this is working correctly when i'm using configuration as :

esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON)
Alexis wrote: Can I already rely on the values given in the Datasheet or this part of the ESP32 is not totally developped yet ?
I've done some measurements by myself but it seems I cannot go below 0.2 mA.

Alexis
right now, my main interest is to get the power consumption stats.

could i rely on the data sheet values for this?

Re: Wake Up from GPIO

Posted: Thu Aug 03, 2017 6:58 am
by WiFive
ESP_PD_DOMAIN_MAX is out of bounds limit, you can't use

Re: Wake Up from GPIO

Posted: Thu Aug 03, 2017 7:21 am
by rajkumar patel
thanks WiFive for such a quick response.

best,