-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
Hello guys,
I have a project with ESP32 WROOM in my own pcb board where I control one transistor to connect the ground my device sensors when my ESP32 is wake and when it goes to sleep it must have a GPIO in low lvl in order to put the transistor in cut mode.
The problem that I figured out is that the GPIO's are floating instead of stay in low mode during the sleep mode.
First I was trying to do this in arduino IDE, that can be the best option for me as my project was original made over there. However I didnt find any function to make the GPIO keep the same state during the deep sleep.
Looking in ESP-IDF i found these function:
gpio_deep_sleep_hold_en();
gpio_hold_en(gpio_num_t BLINK_GPIO);
I understood that they were made for this keep the gpio in previous state during the deep sleep, however i have tried without success.
Following the code so you can easily reproduce this issue:
Code to reproduce this issue
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "esp_sleep.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#define BLINK_GPIO 25
void app_main()
{
printf("Hello world!\n");
gpio_pad_select_gpio(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
/* Blink off (output low) */
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(2000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(2000 / portTICK_PERIOD_MS);
printf("Restarting now.\n");
fflush(stdout);
gpio_deep_sleep_hold_en();
gpio_hold_en(gpio_num_t BLINK_GPIO);
esp_sleep_enable_timer_wakeup(10000000);
esp_deep_sleep_start();
}
Therefore, I would like your help to understand why this is not working and if is possible to make it in arduino IDE.
Thanks in advance!!!