Software reset doesn't work anymore

Hi, I just got an Arduboy. I installed arduino-mk from Debian, and compiled the Blink.ino example with two changes: leonardo instead of uno board type, and correct LED pin. It worked perfectly, just make upload and the LED was blinking!

However that only worked once, or maybe twice (don’t remember). Since then I could never get the software reset step to work. ard-reset-arduino (which is run by make upload) doesn’t reset the bootloader, and neither does a Python script I found to do the same (connect with 1200 baud and disconnect). The normal user sketch keeps running, so the actual upload step with avrdude fails with:

Connecting to programmer:
.avrdude: butterfly_recv(): programmer is not responding

Now the only way for me to load a new program is to press the hardware reset button with a paperclip, and then run make upload within 8 seconds. Apart from being annoying, I’m afraid I’ll break or wear out the reset button very soon if I keep having to do that…

  • Thinking that maybe the reset is handled by the sketch and not the hardware, I tried loading a program that is actually linked to the Arduboy library and calls arduboy.boot(), etc., but that didn’t work. Software reset doesn’t work regardless of which sketch is running.
  • I found this which says a large sketch could overwrite a variable used by the bootloader to handle reset, but compiling everything with -Wl,--section-start,.data=0x800101 as suggested in that post didn’t solve the problem.
  • I tried compiling with SAFE_MODE enabled. It’s not entering safe mode even if I press the Up and Left buttons while booting (could be a separate problem), so I hardcoded it to always enter safe mode regardless of pressed buttons, but even with the safe mode nop loop code running, software reset doesn’t work.

I’m running out of ideas! Did the bootloader get corrupted or what? What can I do to make software reset work again?

I rebooted my Linux computer and now software reset works every time, even after I removed my previous workarounds (such as the --section-start linker option).

I hate computers sometimes :sweat_smile:

Update: this happened again, but I got it back working without rebooting, by unloading and reloading the CDC kernel module.