Jumping to 0x0000, IMHO is a total kludge.
Why are people afraid of correcting the bootloader when there is a problem?
It is open source.....
Just fix the bootloader and be done with it so you can do a real software driven reset
if that is what you want.
Unlike jumping to 0x000, it allows everything to start up clean and fresh.
Jan, the 644 seems to be using an older version of the atmegaBOOT bootloader but the fix
should be the same:
In the bootloader:
Replace this:
#ifdef ADABOOT // BBR/LF 10/8/2007 & 9/13/2008
ch = MCUSR;
MCUSR = 0;
WDTCSR |= _BV(WDCE) | _BV(WDE);
WDTCSR = 0;
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
#endif
with this:
#ifdef ADABOOT
ch = MCUSR;
MCUSR = 0;
wdt_disable();
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
#else
asm volatile("nop\n\t");
MCUSR = 0;
wdt_disable();
#endif
Build a new bootloader and then burn it in your chip and enjoy.
Now if you have recent gcc tools, you may also find that your bootloader may no
longer compile.
If you have errors releated to EECR or EEPE,
you will need to also make this change:
Add this up at the top:
#include <avr/eeprom.h>
then change this:
while(EECR & (1<<EEPE));
to
while(!eeprom_is_ready());
Then it should compile again.
Once you get it in your AVR, you can use something like this to reset the AVR:
Sample sketch to demonstrate software control of reset:
#include <avr/wdt.h>
void setup()
{
Serial.begin(9600);
Serial.println("setup()");
}
void loop()
{
Serial.println("Top of loop()");
for(int x = 3; x ; x--)
{
Serial.println(x);
delay(1000);
}
Serial.println("Reseting Arduino");
#if ARDUINO >= 100
delay(50); // wait for transmission to finish
#endif
resetArduino();
}
void resetArduino()
{
wdt_enable(WDTO_15MS);
noInterrupts();
while(1); // wait to die and be reborn....
}
If your watchdog reset is working, you will see the messages repeating.
If you have a broken WDT bootloader, you will see it the first time and
then the chip will hang in the bootloader until you manually reset it.
--- bill