Arduino hangs after Watchdog Reset

Hi,
I have 10 custom Arduino Boards I have designed. I am running them without the boot loader on the ATMega2560V. When the watchdog timer is used to reset the board it will hang until I cycle the power. Only about half of them are doing this. I am completely stumped. Why?

Thanks

can it be that the WD resets the Arduino direct after boot up again? some interval too short?

can you post your code that causes this behaviour?

I have the Watchdog set to 8 seconds. So I doubt it gets reset during the boot phase.
I also seem to just get white spaces in the serial monitor from the beginning and nothing useful when it seems to be starting up. :confused:
Also after the watchdog reset the reset button no longer works

Below is my setup code

void setup() 
{
 wdt_enable(WDTO_8S);
 wdt_reset();
 for (int i = 0; i < 8; i++) 
 {
    alarming[i] = 0; 
 }  

 sent_packet = 0;
 pinMode(LEDRed, OUTPUT);
 pinMode(LEDGreen, OUTPUT);
 pinMode(LEDBlue, OUTPUT);
 digitalWrite(LEDBlue, HIGH);
 digitalWrite(LEDGreen, HIGH);
 digitalWrite(LEDRed, LOW);

 Wire.begin();
 Serial.begin(9600);
 Serial.println("Getting MAC: ");

 mac[0] = readRegister(0xFA);
 mac[1] = readRegister(0xFB);
 mac[2] = readRegister(0xFC);
 mac[3] = readRegister(0xFD);
 mac[4] = readRegister(0xFE);
 mac[5] = readRegister(0xFF);

 sprintf(tmpBuf, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 wdt_reset();
 Serial.println(tmpBuf);
 pinMode(EtherReset, OUTPUT);
 digitalWrite(EtherReset, LOW);

Serial.println("just reset");
 pinMode(ChargeEnable, OUTPUT);
 pinMode(chipSelect, OUTPUT);
 pinMode(EtherSleep, OUTPUT);
 pinMode(PowerMonitor, INPUT);
 pinMode(batterylevelpin, INPUT);  //Battery Level Meter

 // Initialize and set the contrast to 0x18
 glcd.begin(0x18);
 glcd.display(); // show splashscreen
 // Start Ethernet and UDP
 wdt_reset();
 Serial.println("ethernet begin");
 while (Ethernet.begin(mac) == 0) 
 {
    Serial.println("Failed to configure Ethernet using DHCP");
    // No point in carrying on, so do nothing forevermore:
    continue;
 }
 wdt_reset();
 Udp.begin(localPort);
 Udp.begin(socketsPort);
 Dns.begin(Ethernet.dnsServerIP());

 if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    return;
 } 
 else 
 {
   Serial.println("Wiring is correct"); 
 }
 wdt_reset();
 glcd.clear();
 glcd.drawstring(0, 0, "Mac Address");
 glcd.drawstring(0, 1, tmpBuf);

 while(connectpes() != 1){}

 sensorcon[20] = sensorNum;
 sensorcon[21] = '\0';


 glcd.drawchar(0, 2, sensorNum);
 if (sensorNum == 49) { glcd.drawstring(12, 2, "Sensor Connected");}
 else { glcd.drawstring(12, 2, "Sensors Connected");}
 glcd.drawstring(0, 3, "Version 1.0.0");
 wdt_reset();
 if ( (alarming[0] == 1) || (alarming[1] == 1) || (alarming[2] == 1) || (alarming[3] == 1) || (alarming[4] == 1) || (alarming[5] == 1) || (alarming[6] == 1) || (alarming[7] == 1) )
 {
    digitalWrite(LEDBlue, HIGH);
    digitalWrite(LEDGreen, LOW);
    digitalWrite(LEDRed, HIGH); 
 } 
 else 
 {
    digitalWrite(LEDBlue, HIGH);
    digitalWrite(LEDGreen, LOW);
    digitalWrite(LEDRed, LOW);       
 }
 wdt_reset();
 glcd.display();
 succ = aes.set_key (key, 256) ;
 delay(1000);
 glcd.clear();
 wdt_reset();
}

missing the includes and the definition of the vars (the compiler is my head has parse error’s :wink:

If you place a serial print as first action in the setup() does it show up in the monitor?

Hi, All my code was fine, turns out some of my fuse settings were incorrect. :D So I guess problem solved.