User Tools

Site Tools


20b:defeating_the_watchdog_timer

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:

#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

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