gpio_wakeup_enable() Causes WDT crash

Elijahg
Posts: 12
Joined: Sat Dec 08, 2018 3:30 am

gpio_wakeup_enable() Causes WDT crash

Postby Elijahg » Sun Jul 30, 2023 5:46 pm

Hello,

I am using light sleep on an ESP32. I have a button with a pullup attached to pin 34, which pulls pin 34 to ground when pressed.I use

Code: Select all

gpio_wakeup_enable(34, GPIO_INTR_LOW_LEVEL)
to enable waking from light sleep on this pin. I have an edge interrupt on this pin too for use when the program is running and not asleep. This works fine.

This works fine, except for when the button is pressed for longer than about 250ms, at which point the WDT resets the CPU. This is happening because the interrupt that apparently runs to awaken the ESP runs continuously while pin 34 is low - because it's a level interrupt.

How can I resolve this such that holding the button down won't cause the ESP to reset? Surely immediately prior to sleeping the IDF should hook the interrupt to this pin, and then immediately upon waking it should be unhooked from the pin? With automatic light sleep enabled, I don't have control over when sleep is entered, nor do I know when the ESP has awoken, so I can't do this myself.

Thanks.

Who is online

Users browsing this forum: No registered users and 418 guests