i need some help figuring out my mistake.
I have a custom Esp32 C3 Board which is powered by a 18650 Battery and has a charging and battery protection circuit. The esp is supposed to go to deep sleep after 30 seconds and should wake up on button press. The button is supposed to be the GPIO2 using the internal pull down resistor.
The thing is it seems to work sometimes and sometimes it is just stuck sleeping.
I was wondering is there a clever way to use a watchdog timer to check if the gpio wakeup is still enabled? Is there a problem with my Battery protection circuit? (it looks like when connected to programmer the sleep modes tends not to fail that often) Is GPIO2 any kind of special strapping pin?
Does anyone has experienced something similare?
Here is the schematics: enter image description here enter image description here
The GPIO config + sleep start looks like this.
gpio_config_t io_conf = {};
io_conf.intr_type = GPIO_INTR_ANYEDGE;
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE;
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&io_conf);
esp_deep_sleep_enable_gpio_wakeup((1ULL<<GPIO_INPUT_IO_RIGHT), ESP_GPIO_WAKEUP_GPIO_HIGH);
esp_deep_sleep_start();
So far i can not see any pattern, when the failure occursand when it works.