GPIO wakeup from deep sleep mode

davidi
Posts: 2
Joined: Sat Oct 29, 2016 11:45 am

GPIO wakeup from deep sleep mode

Postby davidi » Thu Nov 03, 2016 12:53 pm

Hi,

I'm designing a battery powered application using the ESP32. For this I need to put the ESP32 in deep sleep mode for most of the time, and only wake on a timer event or if one of multiple GPIO lines go high.

Unfortunately I'm having a bit of trouble getting the ESP32 to wakeup from deep sleep by a GPIO event.

I configured RTC_GPIO7 to be in input mode and setup both EXT_WAKEUP0 and EXT_WAKEUP1 to trigger on this GPIO pin. I verified that the GPIO is indeed working as input, by reading RTC_GPIO_IN_REG. Also when I trigger the GPIO when in deep sleep mode this is recorded in the RTC_GPIO_STATUS_REG register. However the chip doesn't wake up from deep sleep, only by the timer. The RTC_CNTL_EXT_WAKEUP1_STATUS_REG also doesn't pick up the event, It only detects it when I constantly trigger the GPIO pin during system start.

Any suggestions on which register I need to configure to make this work?

My current register configuration:

Code: Select all

// Configure RTC GPIO wakeup input
REG_SET_BIT(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_MUX_SEL); // route GPIO26 to the Digital I/O block
REG_SET_BIT(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_FUN_IE);  // Enable RTC_GPIO7 Input

REG_SET_BIT(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_SLP_SEL); // Enable Sleep status selection(per RTC_IO_PDAC2_SLP_xE)
REG_SET_BIT(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_SLP_IE);  // Set pin as input in sleep mode

REG_SET_BIT(RTC_GPIO_PIN7_REG, RTC_GPIO_PIN7_WAKEUP_ENABLE); // Enable RTC_GPIO7 wake-up (for light sleep only?)
REG_SET_FIELD(RTC_GPIO_PIN7_REG, RTC_GPIO_PIN7_INT_TYPE, 3); // Make RTC_GPIO7 interrupt edge triggered, any edge

REG_SET_BIT(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP1_LV | RTC_CNTL_EXT_WAKEUP0_LV); // Set WAKEUP0 and WAKEUP1 to trigger on a high signal level

REG_SET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL, 7); // Select RTC_GPIO7 as WAKEUP0 input source

REG_SET_BIT(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_GPIO_WAKEUP_FILTER); // GPIO wakeup filtering????
REG_SET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_ENA, RTC_CNTL_WAKEUP_ENA); // Just enable all

REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_SEL, RTC_CNTL_EXT_WAKEUP1_SEL); // Enable all GPIO's as WAKEUP1 input source

//REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_SLP_WAKEUP_INT_ENA);

Who is online

Users browsing this forum: No registered users and 273 guests