ESP32 technical reference manual contains a sub chapter "4.7 Pad Hold Feature". According to content each gpio can hold logic level irrespective of other behavior. We are configuring GPIOs and going into deep sleep. But what we have observed is that only GPIO pads which are in the RTC domain hold the logic level set before going to sleep mode. The other gpio pads do not hold the logic.
If we follow the technical reference manual, this seems to be a wrong behavior.
Could you please provide more information on this?
Pasting the code below for reference -
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/gpio.h"
#include "soc/rtc_io_reg.h"
#include "soc/sens_reg.h"
#include "esp_deep_sleep.h"
#include "rom/gpio.h"
#define GPIO2_RTC_DOMAIN 2
#define GPIO22_NONRTC_DOMAIN 22
#define GPIO_OUTPUT_PIN_SEL ((1<<GPIO2_RTC_DOMAIN) | (1<<GPIO22_NONRTC_DOMAIN) )
static void Init_IO(void)
{
gpio_config_t io_conf;
//disable interrupt
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
//disable pull-down mode
io_conf.pull_down_en = 0;
//disable pull-up mode
io_conf.pull_up_en = 0;
//configure GPIO with the given settings
gpio_config(&io_conf);
gpio_set_level(GPIO2_RTC_DOMAIN, 1);
gpio_set_level(GPIO22_NONRTC_DOMAIN,1);
}
void app_main()
{
Init_IO();
ets_delay_us(1000);
gpio_pad_select_gpio(GPIO2_RTC_DOMAIN);
gpio_pad_pullup(GPIO2_RTC_DOMAIN);
gpio_pad_hold(GPIO2_RTC_DOMAIN);
gpio_pad_select_gpio(GPIO22_NONRTC_DOMAIN);
gpio_pad_pulldown(GPIO22_NONRTC_DOMAIN);
gpio_pad_hold(GPIO22_NONRTC_DOMAIN);
esp_deep_sleep_start();
}
Note: In deep sleep GPIO 2 hold the logic high, whereas GPIO 22 loses its set level.
All GPIO pads do not hold logic level in Deep sleep
-
- Posts: 1
- Joined: Thu Aug 10, 2017 2:39 pm
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: All GPIO pads do not hold logic level in Deep sleep
Have you tried setting 'RTC_CNTL_DG_PAD_FORCE_HOLD' bit in register 'RTC_CNTL_DIG_ISO_REG' to force holding of digital pads?
Code: Select all
SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_HOLD);
-
- Posts: 7
- Joined: Sat Dec 26, 2020 7:33 am
Re: All GPIO pads do not hold logic level in Deep sleep
Is there an equivalent comment in the Arduino IDE for ESP32? I'd love to set `RTC_CNTL_DG_PAD_FORCE_HOLD` to be on so that I can hold a non-RTC GPIO as HIGH while in deep sleep.
Or should I just bite the bullet and port everything over from Arduino IDE to ESP IDF?
Cheers
Andrew
Or should I just bite the bullet and port everything over from Arduino IDE to ESP IDF?
Cheers
Andrew
Who is online
Users browsing this forum: daniel_3in and 84 guests