Arduino Micro (ATMega32u4) will not upload when using watchdog

I have been using watchdog timers on my Arduino Micro projects (ATMega32u4) and have never had a problem with them before.

When I have code uploaded that uses watchdog timers, I have to manually click the reset button on the board to trigger an upload. When I do not have watchdog code on the board it works as intended, automatically resetting the Arduino so it can upload code.

I have been able to replicate this issue with the following code:

#include <avr/wdt.h>

void setup() {         
  wdt_enable(WDTO_15MS);
}

void loop() {
  wdt_reset();
  delay(10);
}

Again, when this code is uploaded to the Arduino, I cannot upload another sketch without manually hitting the resetbutton.

I have updated Arduino IDE to 1.8.13, the Arduino Core to 1.8.3, and re-burned the bootloader multiple times. It does not solve the issue.

New Update!

Adding “Serial.println();” in the loop fixes the issue…
Adding the line in the setup does not help

#include <avr/wdt.h>

void setup() {         
  wdt_enable(WDTO_15MS);
}

void loop() {
  wdt_reset();
  delay(10);
  Serial.println();
}

Does anyone know why this is, or is this a glitch?

I don't think that I can help. But what happens when you make the WDT period longer (e.g. one second)?

But what happens when you make the WDT period longer (e.g. one second)?

Good idea. I tested the watchdog timer at 1 second and the same issue still persists. I even went up to the max of 8 seconds and still had the same problem.