Pro Micro goes into unresponsive state after idling

Second board I’ve had this issue with. I have a sketch using Joystick.h to enable 3 gamepad buttons in Windows. The circuit has 2 hall effect sensors (with pullup resistors) and a toggle switch (with pulldown resistor). After being connected the board will be recognized, but after a few minutes of my circuit behaving as expected it becomes completely unresponsive–even pressing the reset button has no effect on the board. In that state only the red power LED is on, solid. Disconnecting and reconnecting brings the board into that same unresponsive state. No COM ports are opened and Windows doesn’t log any USB connection to the computer. Leaving the board to sit overnight and then plugging it in will allow for another short burst of activity before the board goes unresponsive again.

Board is the Pro Micro QWIIC, with USB-C.

I can provide sketches and circuit diagrams if that will be helpful. Mostly I’m just scratching my head. I have extensively tested my circuit and the sketch (modified to send Serial.print) on an UNO and it was rock solid reliable. I contacted support about this problem with the previous board (I was operating that board with a single hall effect sensor before it start dying) and I’m really curious if this is something I’m doing wrong or a weakness with the board.

That is quite strange, as the “reset” button performs a hardware reset. What I’ve done in cases like this is add a toggle function on a timer to see if the CPU is still ticking away or if something funky has happened - like a sleep mode or interrupt hang situation.

Add the following to the “setup()” function:

pinMode(LED_BUILTIN,OUTPUT);
TIMSK0 |= _BV(OCIE0A); // enable interrupt on TIMER0

And create the following ISR:

ISR(TIMER0_COMPA_vect) {
static uint8_t counter{0};
if (++counter==0) digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); // toggle LED
}  // ISR "TIMER0_COMPA_vect()"

This should produce visible flicker for the onboard LED using the timer and interrupt handler but if the system “hangs” then it will be either full ON or OFF. Better yet is to use an oscilloscope (in which case the counter variable isn’t needed and you should be a 500Hz signal.

I tried adding this to my code but I don’t see any flashing LED. While watching the board I noticed some “arcs” flashing underneath one of the tiny SM components next to the microprocessor…that doesn’t seem good.

I did have a stint where the board worked reliably for about 30 minutes, then it started disconnecting and reconnecting every 10 seconds or so. I cannot get the board to go into the same unresponsive state now, despite that being the norm over 2 days of testing. I’m ready to call this board a total loss.

Those sparks sound like [“Magic Smoke” leaving your board. requiescat in pace.](Magic smoke - Wikipedia)

Hah! Thanks for your help. I’m keeping this LED blinking code to use on future projects.