handle watchdog resets in stk500v2 (Mega 2560) bootloader [imported] #181
Labels
Component: Bootloader
The bootloader is the program used to load the uploaded program into the microcontroller's memory
Component: Firmware
Limited to the contents of the firmwares folder in the core packages
Milestone
This is Issue 181 moved from a Google Code project.
Added by 2010-01-10T21:53:46.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium, Component-stk500v2
Original description
when a watchdog reset occurs, the watchdog timer stays enabled (as
described on p.52 of the atmega 168 datasheet) - and this leads to the
watchdog resetting again and again in the bootloader, requiring a hard
powerdown by the user.
the current ATmegaBOOT_168.c now has the WATCHDOG_MODS part from the
lilypad bootloader - but i think whether or not that is being used
(skipping the bootloader code early on after a watchdog reset), the
watchdog registers should be cleared anyway.
the attached patch is against 0013, but it should still apply with
some offset to the latest (0017) source
kind regards,
gohai
diff -u orig/ATmegaBOOT_168.c new/ATmegaBOOT_168.c
--- orig/ATmegaBOOT_168.c Fri Feb 6 12:56:00 2009
+++ new/ATmegaBOOT_168.c Wed Mar 4 14:08:31 2009
@@ -258,13 +258,12 @@
uint8_t ch,ch2;
uint16_t w;
-#ifdef WATCHDOG_MODS
ch = MCUSR;
MCUSR = 0;
+#ifdef WATCHDOG_MODS
// Check if the WDT was used to reset, in which case we dont
bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
The text was updated successfully, but these errors were encountered: