Wake Up from GPIO

Alexis
Posts: 7
Joined: Mon Dec 05, 2016 7:01 am

Wake Up from GPIO

Postby Alexis » Tue Dec 13, 2016 2:50 pm

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 ?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Wake Up from GPIO

Postby ESP_igrr » Wed Dec 14, 2016 2:27 am

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));

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Wake Up from GPIO

Postby ESP_igrr » Wed Dec 14, 2016 2:28 am

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

Alexis
Posts: 7
Joined: Mon Dec 05, 2016 7:01 am

Re: Wake Up from GPIO

Postby Alexis » Fri Dec 16, 2016 3:46 am

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.

Alexis
Posts: 7
Joined: Mon Dec 05, 2016 7:01 am

Re: Wake Up from GPIO

Postby Alexis » Sat Jan 07, 2017 8:48 am

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

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Re: Wake Up from GPIO

Postby andrew_p » Tue Jan 10, 2017 12:12 am

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?

User avatar
rajkumar patel
Posts: 29
Joined: Mon Apr 10, 2017 12:43 pm
Location: india

Re: Wake Up from GPIO

Postby rajkumar patel » Thu Aug 03, 2017 6:26 am

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?
Regards,
Rajkumar M. Patel

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

Re: Wake Up from GPIO

Postby WiFive » Thu Aug 03, 2017 6:58 am

ESP_PD_DOMAIN_MAX is out of bounds limit, you can't use

User avatar
rajkumar patel
Posts: 29
Joined: Mon Apr 10, 2017 12:43 pm
Location: india

Re: Wake Up from GPIO

Postby rajkumar patel » Thu Aug 03, 2017 7:21 am

thanks WiFive for such a quick response.

best,
Regards,
Rajkumar M. Patel

Who is online

Users browsing this forum: Bing [Bot], ok-home and 327 guests