← index #18613Issue #18961
Related · high · value 0.724
QUERY · ISSUE

Feature Request: Enable WDT Cancel

openby daniel-theiaopened 2025-12-28updated 2025-12-31
enhancement

Description

Previous discussions:

  • https://github.com/micropython/micropython/issues/8600
  • https://github.com/micropython/micropython/issues/8597

In the ESP32 documentation [1] it is possible to enable and disable the WDTs, but not in micropython.

The problem (for me) occurs when you have enabled the WDT and go for a long light sleep - it is possible to wake up to an immediate WDT timeout. For example:

# main.py

import machine

# Setup WDT for normal operation
wdt = machine.WDT(timeout=2000)

while True :
  # Feed the WDT as you should
  wdt.feed()
  # TODO: Do normal stuff
  # Should we go into a light sleep?
  if light_sleep_required() :
    # Should be okay to sleep for 5 seconds or maybe be woken by a pin
    machine.lightsleep(5000)

What's worse is, that the WDT reset doesn't seem to clear the WDT timeout on machine.reset(), and I have witnessed micropython completely stuck in some boot-like loop. This is the opposite of what you want your WDT doing.

In the previous discussions [2] @dpgeorge said:

The watchdog is not intended to be stopped. That is a feature.

There are clear reasons why you may want to stop it:

  • The acceptable timeout depends on what code is being run.
  • Going to sleep and re-waking should not trigger a timeout.
  • Only one section of code is considered "risky".
  • The device is put into some form of OTA mode where all code is stopped and just the download routine runs.

[1] https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/wdts.html

[2] https://github.com/micropython/micropython/issues/8600#issuecomment-1116773752

Code Size

The previous implementation WDT.deinit() should be brought back: https://docs.micropython.org/en/latest/library/machine.WDT.html

It would require a deinit() implementation per port. deinit() could return a bool to indicate if the WDT cancellation was respected, which could allow a transition period too.

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

OpenMV Feature: WDT()

openby kwagyemanopened 2026-03-21updated 2026-03-21
enhancement

Description

WDT working for the STM32, MIMXRT, and Alif on the machine module.

All watchdog types need to work. For example, on the STM32, only the IWDG is implemented right now; however, this watchdog will reset you during deep sleep. There's another watchdog on the STM32 that turns off when in deep sleep.

Code Size

No response

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied