Watchdog Timer goes into loop

Hello forum,

I use WDT in almost all my sketches, normally on 8 seconds.

Yesterday I uploaded a sketch I've used before onto a board to use with a LoRa wireless switch, and all of a sudden the WDT, if the dog is not patted, goes into a loop instead of resetting the board.

Tried with a different board, same thing. Tried with a simple sketch that only tests the WDT and nothing else, same thing.

The closest I got to finding a solution was to update the optiboot url in preferences / boards manager url to: https://github.com/Optiboot/optiboot/releases/download/v8.0/package_optiboot_optiboot-additional_index.json

Then install the latest version of Arduino AVR Boards to 1.6.23.

Still no luck.

Does anyone know what's going on?

To make sure I’m not having some other code interfering with my WDT I’m just using this code to test it for now. As bare as it can get. I comment out the reset to see if it stays in a loop.

#include <avr/wdt.h>

void setup()
{
  wdt_enable(WDTO_8S);
  Serial.begin(9600);
  Serial.println(F("Booting..."));  
}

void loop()
{
  
//  wdt_reset();
 
}

what do you mean by "goes into loop"? a resets loop?

Not sure what is happening in the loop, but 8 seconds after startup pin13 LED comes on and stays on and the board is frozen. When I attempt to upload another sketch in this state the error at the bottom of the screen says:

avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

etc.

Here I have to cut and restore power since not even the reset button does anything. After restoring power I have 8 seconds to upload a sketch before it goes into loop again.

Never had this happen before.

is something attached to the reset pin a module or shield? did you try the default Uno Optiboot bootloader from AVR package?

Nothing attached to the reset pin. For my test I literally plugged in a bare uno with nothing attached, and the sketch above.

I've always use the default uno loader from AVR, surprised why all of a sudden it does this.

heinburgh: Nothing attached to the reset pin. For my test I literally plugged in a bare uno with nothing attached, and the sketch above.

I've always use the default uno loader from AVR, surprised why all of a sudden it does this.

in the post you mention Optiboot 8

This is the first time I dabble with this. Turns out optiboot 8 does not have Uno in the list of boards.

So I'm going through the older versions of AVR uno but not having any luck.

Checking the same code on a mega2560 the wdt works fine.

Anyone with an idea??

@nickgammon I've downloaded your libraries associated with the atmega board programmer sketch.

After loading the sketch the following error appears :

Invalid library found in /Users/heinmyburgh/Documents/Arduino/libraries/Atmega_Fuse_Calculator: no headers files (.h) found in /Users/heinmyburgh/Documents/Arduino/libraries/Atmega_Fuse_Calculator Invalid library found in /Users/heinmyburgh/Documents/Arduino/libraries/Atmega_Fuse_Calculator: no headers files (.h) found in /Users/heinmyburgh/Documents/Arduino/libraries/Atmega_Fuse_Calculator

Also when I open serial monitor I get a broken line of garbage, like this: 5⸮8⸮⸮PȰh⸮J⸮⸮⸮⸮,⸮&⸮߃+⸮⸮⸮-6Xe[`

I know I'm going to sound dumb, but how are these libraries installed? I dumped them all in my arduino/libraries folder, and opened the programmer sketch from there.

I've gone through some old UNO's and some of them handle the 8s WDT with no problem, so I rea;ise now its a bootloader issue.

Thanks, Hein

This is how I connected them, as per Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer

IMG_0264.JPG

Ok, I realise the "invalid library error" has nothing to do with the problem and I took care of that by removing that folder from the libraries directory.

What would be the cause of the random garbage I get from serial monitor when I load the programmer sketch?

Serial port baud rate.

Shaking my head at myself.

what board are you using? Have you selected this board on IDE?

I saw you updated your optiboot. Did you also burn optiboot in your board?

Loaded nickgammon's bootloader programmer sketch and burnt the boards in question in this way.

My watchdog is back!!

heinburgh: Loaded nickgammon's bootloader programmer sketch and burnt the boards in question in this way.

using the "Arduino as ISP" sketch is the easy way