Arduino nano WDT problem

When attempting to use the "wdt_enable();" statement the arduino nano can not be reset correctly.

The LED blinks too fast and you can no longer upload to the board.

So the reset button does not work.

I can only upload when removing power from the arduino and only connect again at the time of upload.

I searched the internet and saw that there is something related to the bootloader, but I think we are already very advanced to let something like this happen, can anyone update this to the next version of the arduino IDE?

In arduino mega2560 the "wdt_enable();" works correctly.

For WDT to work similarly to mega, I need to use this code, instead of using the "wdt_enable(WDTO_8S);"

  //reset watchdog
  wdt_reset();
  //set up WDT interrupt
  WDTCSR = (1 << WDCE) | (1 << WDE);
  //Start watchdog timer with 4s prescaller
  WDTCSR = (1 << WDIE) | (1 << WDE) | (1 << WDP3) | (1 << WDP0);
1 Like

Here's the issue report:

I agree that it's sad this serious bug hasn't been fixed even though it's been known for years.

If you're using an ATmega328P Nano the easiest workaround for you is to:
Connect an ISP programmer (such as Arduino as ISP) to the ICSP header on your Nano.
Tools > Board > Arduino/Genuino Uno
Tools > Burn Bootloader

The Uno's optiboot bootloader doesn't have the watchdog bug and as a bonus is 1.5 kB smaller! You just need to remember to always select Tools > Board > Arduino/Genuino Uno when you're using your Nano after that, you will no longer be able to use it with Tools > Board > Arduino Nano.

If you happen to have an ATmega168 Nano then you can use MiniCore:

I have got the modified bootloader for Arduino nano. So you only need to replace the old one in the Arduino folder.
IDE 1.8.5 didn't update the nano bootloader. Where can i upload it?

Connect an ISP programmer and do burn bootloader