Skip to content
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

Merged
merged 1 commit into from Nov 3, 2017

Conversation

AnHardt
Copy link
Member

@AnHardt AnHardt commented Nov 3, 2017

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.

@AnHardt AnHardt changed the title [1.0] Fix watchdog in WATCHDOG_RESET_MANUAL mode AVR [1.1] Fix watchdog in WATCHDOG_RESET_MANUAL mode AVR Nov 3, 2017
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.");
Copy link
Member

@thinkyhead thinkyhead Nov 3, 2017

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();
Copy link
Member

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?

@thinkyhead thinkyhead merged commit 5289c41 into MarlinFirmware:bugfix-1.1.x Nov 3, 2017
@AnHardt AnHardt deleted the 1.1_watchdog branch November 3, 2017 10:04
@fiveangle
Copy link
Contributor

Where is WATCHDOG_RESET_MANUAL ever enabled ? Is this just for undocumented debugging use where someone just tosses the define in Configuration.h ?

@thinkyhead
Copy link
Member

#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

@fiveangle
Copy link
Contributor

Gah, bitten by my own SublimeText search exclusion: C:\dev\git\Marlin\Marlin,-Configuration*.h

Thanks,

-=dave

@thinkyhead
Copy link
Member

I'm almost sorry I started using that filter field. But it's so handy when needed!

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.

None yet

3 participants