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
[1.1] Fix watchdog in WATCHDOG_RESET_MANUAL mode AVR #8230
Conversation
SERIAL_ERROR_START(); | ||
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer."); | ||
kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display | ||
SERIAL_ERRORLNPGM("Watchdog barked, please turn off the printer."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are hosts okay with this string? i.e., Do they use the old one to detect a kill?
_WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5 | ||
// So worked for up to WDTO_2S | ||
sei(); | ||
wdt_reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are both calls to wdt_reset()
needed here, both before cli
and after sei
?
Where is WATCHDOG_RESET_MANUAL ever enabled ? Is this just for undocumented debugging use where someone just tosses the define in Configuration.h ? |
#if ENABLED(USE_WATCHDOG)
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
//#define WATCHDOG_RESET_MANUAL
#endif |
Gah, bitten by my own SublimeText search exclusion: Thanks, -=dave |
I'm almost sorry I started using that filter field. But it's so handy when needed! |
Longer watchdog timeouts broke the watchdog in WATCHDOG_RESET_MANUAL for AVRs. A register structure was not matched.
The interrupt driven serial send blocked the output of the watchdog interrupt used by WATCHDOG_RESET_MANUAL.