Hi
I have multiple arduino duemilanova around and I have a problem with watchdog timers having the arduino in an endless loop when the watchdog fired.
As the script was provided on the forum I do not want to doubt its quality. I attached the code below (for those who doubt my judgement).
I started thinking there may be a problem with my bootloader so I wanted to upload the bootloader using my AVR ISP AVR-ISP500
I have uploaded programs with this ISP on a mega.
But now I seem to fail to upload sketches and the bootloader to this duemilenova.
What I do: in thee Arduino IDE (I used version 1.0.2)
Select the duemilenova W/ATMega328 board
Select AVR ISP as programmer
Select the com port of the ISP
Power the arduino with USB
Plug the ISP in the ISP (red line on the side labeled 1)
Select Burn bootloader
I get the following output
D:\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CD:\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM25 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "D:\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM25
Using Programmer : stk500v1
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
When I try to upload the blink sketch with the same settings I get
......
c:\temp\build7916804454892230061.tmp\Blink.cpp.hex
Binary sketch size: 1,084 bytes (of a 30,720 byte maximum)
D:\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CD:\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM25 -b57600 -D -Uflash:w:c:\temp\build7916804454892230061.tmp\Blink.cpp.hex:i
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "D:\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM25
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
So that fails to?
On the mega I have to add -e to get it proper uploaded so I tried that as well with the same result
D:\>D:\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CD:\arduino-1.0.2\hardware/
tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM25 -b5760
0 -e -D -Uflash:w:c:\temp\build7916804454892230061.tmp\Blink.cpp.hex:i
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "D:\arduino-1.0.2\hardware/tools/avr/
etc/avrdude.conf"
Using Port : \\.\COM25
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
D:\>
Any help would be appreciated.
Best regards
Jantje
// 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()
{
wdt_disable();
ToggleDelay = 1; // Start with a very short delay
pinMode(LEDpin, OUTPUT);
wdt_enable(WDTO_250MS); // Set watchdog to 1/4 second
}
void loop()
{
wdt_reset();
toggle_led(); // Blinking goes slower and slower until the WDT causes reset, then starts over.
delay(ToggleDelay);
ToggleDelay += 5; // Increase the delay by 5 milliseconds.
}