User Tools

Site Tools


20b:defeating_the_watchdog_timer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

20b:defeating_the_watchdog_timer [2009/10/22 20:17] (current)
bruceb created
Line 1: Line 1:
 +===== Defeating the watchdog timer =====
 +
 +To defeat the watchdog, use the **Watchdog()** function or the **watchdog** inline function (one is inlined, one is a function call).
 +
 +If that isn't defined in your version of the SDK, use the following code snippit:
 +
 +<​code>​
 +#ifdef _ARM_
 +
 +    #include "​board.h"​
 +
 +    TMyApplication *const MyApplication = (TMyApplication*) 0x300000;
 +
 +    // restart the watchdog
 +    ​
 +    inline void Watchdog() {
 +        AT91C_BASE_WDTC->​WDTC_WDCR= 0xA5000001;
 +    }
 +
 +    void watchdog();
 +
 +// same function as above, but not inlined...
 +
 +#else
 +
 +    extern TMyApplication MYAPPLICATION;​
 +
 +    TMyApplication *const MyApplication= &​MYAPPLICATION;​
 +
 +    inline void Watchdog() { }
 +
 +#endif
 +</​code>​
 +
 +Don't forget to define MYAPPLICATION in the Windows-only part of the code somewhere.
 +
  
20b/defeating_the_watchdog_timer.txt · Last modified: 2009/10/22 20:17 by bruceb