My Adafruit Feather M0 has two reset options I know of:

  • single click restarts existing program
  • double-click listens for an upload for a few seconds, then restarts existing program

Is there another option to have an existing program erased or replaced with something benign like a blinker, e.g.

  • triple-click erases existing program and listens for upload indefinitely

If not, what is the level of difficulty to modify the standard bootloader to implement this option?


The rationale for this option is to recover a bricked board, e.g. with USB port turned off by a low power mode, so the regular software upload doesn't work any longer, at least without some trickery.

  • 1
    Isn't the bootloader open-sourced? Did you look for it? Aug 4, 2021 at 15:16
  • Which Arduino? Single click of what exactly?
    – Nick Gammon
    Sep 3, 2021 at 9:01
  • @NickGammon Tripple-click reset in the title, strongly suggest clicking the reset button. Arduinos with USB firmware upload capability. Sep 3, 2021 at 11:03
  • You still haven't answered "which Arduino?" Is it a secret? In any Arduino the reset button resets it, there is no such thing as double-clicking reset. And certainly not triple-click. Resetting invokes the reset circuitry which makes the processor go through its reset code, clearing all registers and starting the code from the start.
    – Nick Gammon
    Sep 3, 2021 at 11:45
  • 1
    Next time, put that information in the question. That's where it belongs.
    – Nick Gammon
    Sep 5, 2021 at 6:32

2 Answers 2


Now that we know the board type (Zero) — which took a couple of questions to elicit — it is possible to give a reasonable answer. Had it been a Uno I would have said that no, it doesn't do that, and it would take too much program space to implement it.

Is there another option to have an existing program erased or replaced with something benign ...

No, not that I am aware of, unless the documentation for the Zero says otherwise.

If not, what is the level of difficulty to modify the standard bootloader to implement this option?

Moderate, I would guess.

As for the Zero, with 256 KB of programmable memory it probably could be implemented by changing the bootloader. Any such change will, of course, reduce the amount of memory available for other tasks, but perhaps that isn't as big a deal if you start with 256 KB.

You would have to detect the triple-click somehow, for code running right after reset this could be tricky, but possibly achievable, as you say it has been for double-clicks.

Find the source code for the bootloader, see how it detects double-clicks, make it detect triple clicks, and have your "benign" program stored in the bootloader as a block of data ready to be copied into program memory.

There are a few alternatives you could consider:

  • If you have a spare pin in your project, make it so that if (say) pin 13 is grounded at startup, do nothing (other than go into a tight loop). This could be done before anything that might make reprogramming hard, like going into low power mode.

  • Reprogram it using SWD programming (rather than the bootloader). I don't know the exact details for the Zero, as I don't own one, but there must be a way, otherwise you wouldn't be able to put the bootloader onto it in the first place. Judging by what I read elsewhere the Atmel ICE is the device you need to reprogram it in that way.

  • Judging by what I read here you can access the bootloader by selecting Arduino Zero (programming port) as the board, and Atmel-EDBG as the programmer. Then you could tell the Atmel-EDBG to reprogram the board. My details here are hazy but you could look into that as an option.

  • I like the idea of using an extra pin for that purpose. Double-click works most of the time, but you have to synchronize your keystrokes and reset. Sep 4, 2021 at 3:06

All Arduino bootloaders for boards with native USB support double reset as a way to activate the bootloader in case the sketch doesn't respond and fails to handle the USB. (The code linked from the Arduino core to your sketch handles the USB for MCU with native USB).

The M0 Arduino bootloader source code is in Arduino SAMD boards support package. Adafruit may use a modified version. The bootloader is strange because avrdude is used to upload over this bootloader and the board reports as ATmega to avrdude.

The M0 bootloader (and the ATmega 32u4 bootloader for Leonardo and Micro) have timeout after double reset. If no upload occurs some seconds after the double reset, they start the sketch.

You want to add a triple reset to replace the sketch which doesn't respond with a save sketch which will handle the USB and allow upload at any time. This would require to change the bootloader source, build the bootloader and use a SWD programmer to burn it (or create a sketch which replaces the bootloader).

Better option is what Arduino did for the Zero and MKR bootloader. The bootloader activated with double reset doesn't timeout with this bootloader and upload is possible anytime after double reset (until next reset or power-cycle).

The original M0 and Zero are almost the same board. One was sold by arduino.org other by arduino.cc. The most important difference is the bootloader.

It is possible to use M0 board as Zero with the Zero bootloader. By replacing the bootloader, you get the double reset without timeout. Other benefits are faster upload with bossac, the bootloader is half the size of the M0 bootloader and the Zero bootloader doesn't reset the internal RTC as the M0 bootloader does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.