projects
/
pub
/
USBaspLoader.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BUGFIX: fix issue 6 to really disable watchdog timer
[pub/USBaspLoader.git]
/
firmware
/
main.c
diff --git
a/firmware/main.c
b/firmware/main.c
index
87f0641
..
bd36e06
100644
(file)
--- a/
firmware/main.c
+++ b/
firmware/main.c
@@
-644,6
+644,15
@@
int __attribute__((__noreturn__)) main(void)
#endif
if(bootLoaderCondition()){
#if NEED_WATCHDOG
#endif
if(bootLoaderCondition()){
#if NEED_WATCHDOG
+# if (defined(MCUSR) && defined(WDRF))
+ /*
+ * Fix issue 6: (special thanks to coldtobi)
+ *
+ * The WDRF bit in the MCUSR needs to be cleared first,
+ * otherwise it is not possible to disable the watchdog
+ */
+ MCUSR &= ~(_BV(WDRF));
+# endif
wdt_disable(); /* main app may have enabled watchdog */
#endif
initForUsbConnectivity();
wdt_disable(); /* main app may have enabled watchdog */
#endif
initForUsbConnectivity();