1.3mA sleep current when using EXT0 together with time wakeup (5uA if timer only)

AloyseTech
Posts: 22
Joined: Mon Jul 22, 2019 2:29 pm

1.3mA sleep current when using EXT0 together with time wakeup (5uA if timer only)

Postby AloyseTech » Mon Jul 22, 2019 3:23 pm

Hi,

I would like to use both timer and ext0 as deep-sleep wake up source. With Timer only, I can achieve 5uA as expected. But when I enable ext0, the sleep current jumps to 1.3mA! I understand the doc says RTC_IO peripherals must be powered to use the ext0 wake up, but does it use that much current?!

I use the esp32-arduino framework and here is my code :

Code: Select all

#include <WiFi.h>
#include "driver/rtc_io.h"

#define PIN_IRQ (27)
#define PERIOD (10)

/*Comment this to use timer only*/
#define EXT_WAKE_UP

void setup()
{
  rtc_gpio_deinit((gpio_num_t)PIN_IRQ);

  Serial.begin(115200);
  print_wakeup_reason();
  Serial.println("Start");

  esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
  esp_sleep_enable_timer_wakeup(uint64_t(PERIOD * 1000000));

#ifdef EXT_WAKE_UP
  esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_IRQ, 1);
#endif

  WiFi.setAutoReconnect(false);
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
}

void loop()
{
  //do things
  delay(5000);
  Serial.println("Go to sleep...");
  Serial.flush();

  esp_deep_sleep_start();
}


void print_wakeup_reason() {
  esp_sleep_wakeup_cause_t wakeup_reason;

  wakeup_reason = esp_sleep_get_wakeup_cause();

  switch (wakeup_reason)
  {
    case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;
    case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
    case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
    case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
    case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
    default : Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
  }
}


chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: 1.3mA sleep current when using EXT0 together with time wakeup (5uA if timer only)

Postby chegewara » Sun Aug 11, 2019 12:40 am

Did you try with EXT1? I think i read somewhere its more power efficient.

Who is online

Users browsing this forum: No registered users and 86 guests