mega 2560 & <avr/wdt.h>

Hi Guys - did a bunch of searches about the bug with the mega 2560 watchdog and bootloader versions.

My Mega is from 2014 and understand that it could still have an issue due to the chip it shipped with?... would this code I have on my R3 work if I were going to give it a go on my mega? Or am i way off? (the risk could be a bricked mega)

#include <avr/wdt.h>

void setup()
{  
// Watch dog Set up		
wdt_disable();		
delay(2L * 1000L);		
wdt_enable(WDTO_4S);		
// End Watch dog Setup
}

void loop()
{  
my code here
wdt_reset(); // feed the dog
}

thanks in advance

AG

Hi

the bug with the mega 2560 watchdog

What bug ?

Hi HugoPT,

it is in reference to this thread... mega2560 bootloader & watchdog - Microcontrollers - Arduino Forum

Hard to answer because there is no way to know what version bootloader your 2560 board has in it. The problems has been known and identified several years ago. And there is a 'fixed' bootloader distributed with the current arduino IDE, but again your board may still have the older bootloader that does suffer the WDT bug.