Hey everybody,
According to ESP32 Datasheet V1.3 on page 22, in hibernation mode "some RTC GPIOs are active".
I understand they can be used as "ext0" or "ext1" wakeup sources after configuring them as inputs.
What if they are configured as outputs? Can they retain output state (high or low) that has been set up before putting the chip into hibernation mode?
[Solved] Can RTC IO output state be retained in hibernation mode?
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
[Solved] Can RTC IO output state be retained in hibernation mode?
Last edited by ESP_krzychb on Fri May 26, 2017 6:22 pm, edited 3 times in total.
Re: Can RTC IO output state be retained in hibernation mode?
For RTC IOs you can use rtc_gpio_hold_en function.
For digital IOs there is a RTC_CNTL_DG_PAD_FORCE_HOLD bit which forces all pads to hold their state.
For digital IOs there is a RTC_CNTL_DG_PAD_FORCE_HOLD bit which forces all pads to hold their state.
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: Can RTC IO output state be retained in hibernation mode?
Thanks @ESP_igrr!
Works great from both main program (using rtc_gpio_hold_en / dis) and from ULP (using individual registers and bits).
EDIT:
A short description how to use hold enable / disable functionality together with an ULP program is available under https://github.com/krzychb/ulp-loop
Works great from both main program (using rtc_gpio_hold_en / dis) and from ULP (using individual registers and bits).
EDIT:
A short description how to use hold enable / disable functionality together with an ULP program is available under https://github.com/krzychb/ulp-loop
Re: [Solved] Can RTC IO output state be retained in hibernation mode?
Hi @krzychb, I have studied and tested your example code and it is very usefull to understand deep-sleep and RTC GPIOs.krzychb wrote: ↑Fri May 26, 2017 6:23 amThanks @ESP_igrr!
Works great from both main program (using rtc_gpio_hold_en / dis) and from ULP (using individual registers and bits).
EDIT:
A short description how to use hold enable / disable functionality together with an ULP program is available under https://github.com/krzychb/ulp-loop
I have a question: in my case I need to put in hybernation (i.e. deep-sleep within only RTC timer, no slow/fast memory, no ULP) retaining GPIO23 (which is not RTC).
I have written a very simple test:
Code: Select all
main(){
printf("RESET:%d;wake:%d\n", rtc_get_reset_reason(0), esp_sleep_get_wakeup_cause());
//wait start
uint8_t cnt=0;
while (cnt < 3)
{
printf("startWait:%d\n", cnt);
vTaskDelay(pdMS_TO_TICKS(1000));
cnt++;
}
//Config gpio_num_23
gpio_config_t config = {
.pin_bit_mask = BIT64(GPIO_NUM_23),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE
};
ESP_ERROR_CHECK(gpio_config(&config));
cnt = 0;
while (cnt < 3)
{
printf("After config:%d\n", cnt);
vTaskDelay(pdMS_TO_TICKS(1000));
cnt++;
}
// Wake up in 5 seconds
esp_sleep_enable_timer_wakeup(5000000);
printf("set LOW GPIO_NUM_23 and HOLD\n");
gpio_set_level(GPIO_NUM_23,0);
gpio_deep_sleep_hold_en();
printf("going to DEEP SLEEP\n");
esp_deep_sleep_start();
}
the pin goes high (I guess for its internal pull-up) until the "gpio_config" function is called.
Is it mandatory to introduce a wake stub in order to retain the GPIO level after wake-up from deep sleep?
Thanks
-
- Posts: 7
- Joined: Sat Dec 26, 2020 7:33 am
Re: Can RTC IO output state be retained in hibernation mode?
Hi ESP_Igrr,
That sounds perfect! Could you please provide an example of how to set that bit on, for beginners like me?
Pushing my luck, is there a way to set this in Arduino IDE for ESP32?
Cheers
Andrew
Who is online
Users browsing this forum: Bing [Bot] and 123 guests