Skip to content

ESP32-S2 watchdog.deinit() doesn't succeed or raise an error #4324

Closed
@tylercrumpton

Description

@tylercrumpton

I've been trying to work with the watchdog module on my UnexpectedMaker FeatherS2 (esp32s2) running 6.2.0-beta.2, and have noticed that the watchdog.deinit() function doesn't successfully stop the watchdog, nor does it raise an error indicating that deinit() is not available for this platform. My example script is:

from watchdog import WatchDogMode, WatchDogTimeout
from microcontroller import watchdog as w

print("Initial mode:", w.mode)
w.timeout = 10  # Set a timeout of 10 seconds
w.mode = WatchDogMode.RAISE
w.feed()
print("Watchdog running mode:", w.mode)
w.deinit()
print("After deinit mode:", w.mode)

while True:
    try:
        while True:
            pass
    except WatchDogTimeout:
        print("The watchdog got hungry!")

Which results in an output like:

Initial mode: None
Watchdog running mode: watchdog.WatchDogMode.RAISE
After deinit mode: watchdog.WatchDogMode.RAISE
The watchdog got hungry!
The watchdog got hungry!
The watchdog got hungry!
   ... continues every 10 seconds

It appears that stopping the watchdog should be supported based on the CircuitPython wdt HAL implementation for the esp32s2 and the ESP-IDF task_wdf component.

I've tried this on both:
Adafruit CircuitPython 6.2.0-beta.3 on 2021-03-04; FeatherS2 with ESP32S2, and
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; FeatherS2 with ESP32S2

Metadata

Metadata

Assignees

Labels

bugespressifapplies to multiple Espressif chips

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions