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.