Skip to content

Prevent hang on watchdog reset with DUE Platform #27803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

InsanityAutomation
Copy link
Contributor

An unusual condition was observed with Archim2 boards where the watchdog would trigger during long operations, such as USB reads, and the board would freeze and not reset. The issue was partially mitigated by moving off the UHS2 USB library back to SD, however the issue still occasionally poked out.

CDSmith at Lulzbot began digging into D100 and observed it would hang and stop execution but the board did not reset, so we looked into the watchdog flags. We added code to report the watchdog state and monitored the output inside D100

image

We found the MCU did attempt a reset but did not fully load back to the user program. From there, we looked at the registers and saw we were performing a CPU only reset and not to PIO state, so we cleared this register and found we could consistently reboot following a watchdog trip.

@thinkyhead
Copy link
Member

Rather than comment out the flag and add a note I went ahead and added a define named WATCHDOG_PIO_RESET that is set for all the DUE environments (env:DUE, env:DUE_debug, env:DUE_archim). For the benefit of Arduino IDE I then also added the flag as the default behavior in the HAL. So any environments that want to override it can use -DWATCHDOG_PIO_RESET=0, or a user can #define WATCHDOG_PIO_RESET false to only reset the processor and not the PIO.

@thinkyhead thinkyhead merged commit 9a90194 into MarlinFirmware:bugfix-2.1.x Apr 22, 2025
66 checks passed
@InsanityAutomation
Copy link
Contributor Author

Thanks, I'll pull it up with the added changes and test it on hardware If not tomorrow, Thursday.

@InsanityAutomation
Copy link
Contributor Author

Verified on a live machine, working as intended post changes

@InsanityAutomation InsanityAutomation deleted the DueWatchdogHangs branch April 24, 2025 14:20
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request May 15, 2025
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.

3 participants