Skip to content

Fix hardcrash from activating watchdog in boot.py on nordic - #11295

Open
FoamyGuy wants to merge 1 commit into
adafruit:mainfrom
FoamyGuy:nordic_watchdoog_bootpy_fix
Open

Fix hardcrash from activating watchdog in boot.py on nordic#11295
FoamyGuy wants to merge 1 commit into
adafruit:mainfrom
FoamyGuy:nordic_watchdoog_bootpy_fix

Conversation

@FoamyGuy

@FoamyGuy FoamyGuy commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

On nordic port it is not possible to stop the watchdog peripheral after it has been activated in RESET mode.

The existing implementation has two issues:

  1. It is trying to to handle raising an exception to the user from deinit(), but nothing in the python API was ever calling deinit(). Setting mode = None was seeming to succeed, it doesn't raise, and checking mode after setting to None does indeed return it as None but the watchdog is still activated and the bite will still reset.

  2. The way that the exception handling that is in deinit() works causes the path that calls it when the watchdog is activated from boot.py to hard crash with this error after boot.py runs:

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
NLR jump failed. Likely memory corruption.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

At this point the watchdog is still activated and the impending bite will reset the device again into safemode with reason WATCHDOG which will then prevent boot.py from running stopping the execution.

Fixed by removing the handling from deinit() and instead do it if/when the user attempts to set mode = None. With this change the user now gets a proper exception raised when they attempt to deactivate the watchdog from RESET mode, and the deinit() that happens after boot.py no longer causes the hard crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant