I can't get WDT (watchdog timer) working on ATmega2560
Here's a minimal example of using WDT on ATmega2560. Fuses on default (WDTON unprogrammed).

#include &lt;avr/io.h&gt;

int main(void)
{
    if(MCUSR &amp; (1&lt;&lt;WDRF))    // check if reset by wdt
    {
        MCUSR = 0;   // clear flags
        DDRA = 1;    // indicate reset by wdt
        PORTA = 1;
    }

    // enable watchdog system reset
    WDTCSR |= (1&lt;&lt;WDCE) | (1&lt;&lt;WDE);
    // 256K cycles ~ 2 seconds
    WDTCSR = (1&lt;&lt;WDE) | (1&lt;&lt;WDP2) | (1&lt;&lt;WDP1) | (1&lt;&lt;WDP0);

    while(1)
    {
        __asm__ __volatile__ ("wdr");    // feed wdt
    }
    return 0;
}


Comment out line __asm__ __volatile__ ("wdr"); and AVR will be reset by WDT after 2 seconds.

See the datasheet chapter 12.4 Watchdog Timer for more info.