Does the built in Watchdog work

I am using Mega 2560 and would like to use the watchdog. In an old thread I read that the inbuilt watchdog does not work with Arduino bootloader. Does this mean that built in watchdog cant be used in Arduino projects. Is this true even today?

I can build a HW watchdog, but if there exists already one, why bother.

Works fine with my Arduino UNO R2.

//  Watchdog Timer Example
#include <avr/wdt.h>

unsigned long ToggleDelay;  //  When this delay grows to longer than the WDT interval the WDT resets the Arduino

const int LEDpin = 13;

void toggle_led()
  digitalWrite(LEDpin, !digitalRead(LEDpin));

void setup()
  ToggleDelay = 1;   // Start with a very short delay
  pinMode(LEDpin, OUTPUT);
  wdt_enable(WDTO_250MS);  // Set watchdog to 1/4 second

void loop()
  toggle_led();   // Blinking goes slower and slower until the WDT causes reset, then starts over.
  ToggleDelay += 5;   // Increase the delay by 5 milliseconds.

Seems to be fixed. Very good to know. Do you know if the bootloader is fixed or what happened?

Seems to be fixed. Very good to know. Do you know if the bootloader is fixed or what happened?

My understanding of the problem is:

a) The WDT reset does NOT disable the WDT. This means that if the bootloader doesn’t explicitly disable WDT and the bootloader takes longer than the WDT interval to get to your setup() function the WDT will cause a reset loop.

b) The newer bootloaders detect the cause of a reset and either look for a download (Reset line pulled low) or go straight to your sketch (Power-on). If they treat the WDT reset as a Reset-line reset they would exacerbate issue ‘a’.

I’m not sure if/when the bootloaders were changed but the 1.0 UNO bootloader works fine with a 1/4 second WDT.

I'm not sure that a test on an ATmega328 would determine if the ATmega2560-based bootloader is fixed.

In fact, I believe that is the case. The Uno's bootloader is fixed while the MEGA-2560 bootloaders are not.