Watch Dog Timer not working on UNO?

I have an UNO (my first Arduino, and I just realised it's a counterfeit...) and I'm trying to get WDT to work on it. I have tried several examples I found online, but they all have the same result - the board goes into a loop and does not reset.

From what I've read the UNO comes out the factory with optiboot, so in theory it should not be necessary to flash the bootloader, but WDT does not work on it as is.

Should I flash it with optiboot, and if yes, which one of the six optiboot oprions do I choose for my board?

Here's one of the sketches I used:

#include <avr/wdt.h>
void setup()
{
  wdt_disable();  //disable previous watchdog
  Serial.begin(9600);
  Serial.println("hello");
  wdt_enable (WDTO_8S);
  Serial.println("Wdog enabled");
}
void loop()
{
  Serial.print(".");
  delay(500);
//  wdt_reset();
}

The result is this printing dots for 8 seconds and then it goes haywire, the dots stop coming and no reset.


You can just select Tools > Board > Arduino/Genuino Uno and then do a Tools > Burn Bootloader to make sure the bootloader is not the problem. The Uno bootloader is optiboot and is compatible with watchdog resets. It should already be on the Uno but if it's easy for you to connect an ISP programmer then it certainly can't hurt to make sure you have the right bootloader. I tend to replace the bootloader on all my boards immediately after I get them just to be sure they're running the right version.

Thanks Pert.

I selected as the board Arduino/Genuino Uno, programmer selected "Arduino as ISP", select "Burn bootloader" but then after thinking on it a while it responds with:

"avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x25
Error while burning bootloader."

After getting this error I uploaded a sketch successfully, the sketch runs on the board ok, so the hardware is ok - just an issue burning the bootloader.

Using Mac OS and IDE 1.8.1. All updates are current. Any ideas?

You wrote "my first Arduino"
Just to make sure: Did you use an ISP programmer or do you have a second Arduino with the "Arduino as ISP" sketch loaded? The UNO alone cannot update it's own bootloader

olf2012:
You wrote "my first Arduino"

You're a sharp reader. Yes you got me, I tried to burn it straight from the IDE, that's how green I am. Figured out my mistake soon enough. Waiting for my second (authentic) Arduino to arrive in the mail then I'll try again.

Still a a bit confused why an UNO (albeit a counterfeit) would not have the optiboot loader on it? Is this common for wannabee boards?

I bought some 328 chips with pre-installed bootloader from a reliable source. They had optiboot installed, but it was an old version that had a 30k upload limit. Maybe your dealer just happened to have some old boards still lying around. Shit happens :wink: