[Solved] Arduino Nano 3.1 Watchdog not resetting / unable to change fuses

Hi there

I got a shiny new Arduino Nano V3.1 and I’m trying to work out why the watchdog is not resetting the chip, e.g. won't reboot.

The code below will, on a Arduino Uno, result into a restart of the AVR every 4 seconds, all fine. But the Nano gets stuck, e.g. the dotting stops, but no further hello. It seems to stop the application but fails on resetting the ATmega328p. Also re-flashing does not work anymore, i can only upload any code during that 4 second window (lucky me i haven't tried 100ms :))

I googled a bit and got the impression that the RSTDISBL Fuse is set to Pin6 instead of reset, but trying to set this fuse with AVR Dude fails when writing the lfuse and hfuse bytes (only efuse work).

Digging deeper I found that the Fuses might be protected with the Lock bits, and in a Nano specific discussion I found that there might also be a wiring issue with the SCK and MOSI the wrong way around, which might be fixed in avrdude.conf.

Now this all goes a bit too far for me, I don't feel stable with messing with the chip internals, I only like to have the Watchdog enabled.

Am I completely off track here or can someone pinpoint me to the right steps?
(no, jmp 0x0000 is not the same as a watchdog, I might have timeouting-functions)

Cheers & thx
Maldex

#include <avr/wdt.h>
void setup()
{
	wdt_disable();  //disable previous watchdog
	Serial.begin(9600);
	Serial.print("hello");
	wdt_enable (WDTO_4S);
	Serial.println("Wdog enabled");
}
void loop()
{
	Serial.print(".");
	delay(500);
}
avrdude -patmega328p -carduino "-P\\.\COM36" -b57600 -V -D -y -u -Uflash:w:main.hex:a -Ulfuse:w:0xFF:m -Uhfuse:w:0xDD:m -Uefuse:w:0x00:m "-CC:\Programme\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf"

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (10844 bytes):

Writing | ################################################## | 100% 5.42s

avrdude: 10844 bytes of flash written
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.14s

avrdude: 1 bytes of lfuse written
avrdude: reading input file "0xDD"
avrdude: writing hfuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.14s

avrdude: 1 bytes of hfuse written
avrdude: reading input file "0x00"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of efuse written

avrdude done.  Thank you.

I had the same problem, every time my nano V3.1 used to enable the watchdog and the watchdog will time out the Arduino will just go crazy. Same symptoms as yours. I believe that it is something with the original bootloader not being able to handle the avr function. Anyway, I fixed it by loading a "better" bootloader called optiboot. I used another Arduino to burn it. Now my nano "looks" like a uno to the Arduino IDE which doesn't have these problems since it has optiboot from factory, or at least in the newest ones. Also they claim that such bootloader only takes a quarter of space compared to the original one.

Probably you want to use this link:

The optiboot bootloader should be available in the last Arduino IDE, 1.0.5, otherwise you can download it here:

http://code.google.com/p/optiboot/

Good luck
-Missael

Solved! thanks a lot for the bootloader hint, that did the trick.

Although the Arduino IDE thing to burn boot-loader never ever worked for me, i usually relay on Nick Gammon's programmer firmware arduino_sketches/Atmega_Board_Programmer at master · nickgammon/arduino_sketches · GitHub. Does essentially the same.

Good thing is: programming the Nano (which also looks like uno now) works bit faster with 115200 baud :slight_smile:

thanks again

Hi
i have the same problem with the Nano when i try use watchdog

iam downloaded the last optibotloaderhttps://github.com/Optiboot/optiboot

and made "hardware" folder in sketch and copy the optibootloader there.

i see optibootloaders but i tryed burn it with use another arduino and use usb asp i can burn in sketch etc so the ISP work but at the optiboot i get error while burning bootloader.

Error while burning bootloader.
java.lang.NullPointerException
at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:305)
at processing.app.Editor$59.run(Editor.java:2578)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

any idia what i do?

full error message:

Arduino: 1.6.5 (Windows 7), Board: "[Optiboot] Arduino Duemilanove or Nano w/ ATmega328"

Error while burning bootloader.

java.lang.NullPointerException

at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:305)

at processing.app.Editor$59.run(Editor.java:2578)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:709)

at java.awt.EventQueue$3.run(EventQueue.java:703)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Arduino nano watchdog is working without boot loader, I have programme Nano by another arduino as a ISP. Watchdog is working, With boot loader it is not working