0

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.

4
  • 1
    "Is GPIO2 any kind of special strapping pin"?, yes, read the Technical Reference Guide, GPIO2 need to be pull-up at boot. For ESP32-C3, the GPIO that can be used for external wake-up needs to be one of the RTC pins (i.e. GPIO0-GPIO5). Commented Mar 21, 2024 at 12:29
  • BTW, you should connect a 5.1k-ohm resistor to each of the CC pins on the USB type c port. You might not get the USB power for certain type of USB cable or port. Read Introduction to USB Type-C about CC pins. Commented Mar 21, 2024 at 12:31
  • Thanks for the input. The resistor to ground or 5v? But when i press gpio2 it is high at boot. it seems like it is something with the power supply or uart. because as long as the programming adapter is connected the esp wakes up fine. Thanks Commented Mar 21, 2024 at 12:42
  • 5.1k-ohm resistor between CC and GND. Maybe I didn't explain it clearly on GPIO2, see my answer to a similar question here. Commented Mar 21, 2024 at 12:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.