arduino / arduino/ArduinoCore-avr
Mega2560 watchdog timer issue fix
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
The bootloader for the Mega2560 in version 1.0.5 still does not recover from an outstanding watchdog timer.
See this thread for a discussion:
http://forum.arduino.cc/index.php?topic=204174.msg1507303#msg1507303
There are diffs there, but basically the part about fixing issue 181 needed to be changed to:
```
#ifdef _FIX_ISSUE_181_
//************************************************************************
//* Dec 29, 2011 Issue arduino/Arduino#181, added watch dog timmer support
//* handle the watch dog timer
uint8_t mcuStatusReg;
mcuStatusReg = MCUSR;
__asm__ __volatile__ ("cli");
__asm__ __volatile__ ("wdr");
MCUSR = 0;
WDTCSR |= _BV(WDCE) | _BV(WDE);
WDTCSR = 0;
wdt_disable ();
__asm__ __volatile__ ("sei");
// check if WDT generated the reset, if so, go straight to app
if (mcuStatusReg & _BV(WDRF))
{
boot_rww_enable(); // enable application section
asm volatile(
"clr r30 \n\t"
"clr r31 \n\t"
"ijmp \n\t"
);
}
//************************************************************************
#endif
```
Also see:
http://forum.arduino.cc/index.php?topic=206242
Someone is grumbling that the Mega2560, as sold, cannot handle a sketch with "!!!" in it. Which, after all, is quite likely in a sequence of binary data (like an image) or just someone over-enthusiastic with punctuation!!! (like that)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.