ERASE Button of Arduino DUE

As it is seen in the following figure (extracted from DUE Schematic), the IDE always erases (can erase) the Flash of the DUE by software command before uploading a new sketch. If so, why is there an incorporation of a manual ERASE Button on the Arduino DUE?

The ERASE button has a serious drawback which is: the currently executing program can always be erased (and indeed, it erases) by holding down (for a second or more) the button. Is there any way to disable the functionality of the ERASE Button?

There are situations where the running sketch can be so badly locked up that you can't just upload a sketch with the IDE. The programming port should be able to unlock it but sometimes it seems like Erase works better.

For incorporation into a permanent project where you don't want anyone to press the button, then either build it into a box or remove the button from the PCB.

Note that pressing Erase when there's no power doesn't erase anything. It's only a problem if someone can reach the button while it's powered up.

1 Like

Thanks for the rational opinion.

I am exploring more technical questions on this issue, and they will be posted in this thread in due times.

I'm needing the reset button because I'm using the Arduion Due itself without any of the Arduino IDE. That works just fine by manually pressing the ERASE Button (after that the Atmel SAM-BA Bootloader comes online) and sending the code.


You are using Arduino DUE Board, but you not using using the Arduino IDE. Then, how do you store your new application program codes into the flash of the SAM3X8E after the deletion of the the previous program using the ERASE Button?

BTW: What have you wanted to mean by saying 'Boot-loader comes online?

(Under Arduino IDE, the Boot-loaded executes interactive session with the IDE and uploads the Intel-hex formatted application program codes (the sketch) into the targeted flash area of the MCU.)

Golam, you do understand that all the Arduino IDE does is call another program to do the actual upload? For AVR Arduinos it’s AVRDUDE and for the Due it’s SAM-BA.

The Due is a little different because it doesn’t have a bootloader like the AVR. The code which does that function is in ROM and can never be erased from the Due.


We have the Boot Location, then the Boot Section (optional), then the Boot-Loader Program (optional),
and finally the Application Program.

For the AVR in Arduino UNO/MEGA/NANO, the Boot-Loader Program is semi-permanently permanently stored in the Boot-Section (part of flash) whose placement and boundaries are determined by Fuse Bits.

For ARM, the Boot-Loader Program is permanently stored in the ROM Section of SAM3X8E.

BTW: Is this ROM factory masked or field programmable?

As far as I know the ROM is not changeable. On all Atmel SAMs there is the SAM-BA Bootloader. The bootloader is only active when you've erased the flash.

For AVR, the bootloader can be erased. The Arduino IDE makes it difficult (but not impossible) to accidentally erase the bootloader.

The SAM bootloader is ROM. Read Only Memory. It can't be erased without physically destroying the chip with a hammer.

The SAM3X has a bootloader in ROM that cannot be erased. I'm not sure whether there's an Arduino bootloader as well. The ROM bootloader is activated when the flash is erased...

The datasheet says that an application can reprogram the erase pin (PC0) as a GPIO, in which case it will no longer work as an erase pin, except at reset (ie before the application sets it to a GPIO.)

  • 6.6 ERASE Pin
    The ERASE pin is used to reinitialize the Flash content (and some of its NVM bits) to an erased state (all bits read as logic level 1). The ERASE pin and the ROM code ensure an in-situ reprogrammability of the Flash content without the use of a debug tool. When the security bit is activated, the ERASE pin provides the capability to reprogram the Flash content. It integrates a pull-down resistor of about 100 kΩ to GND, so that it can be left unconnected for normal operations.
    This pin is debounced by SCLK to improve the glitch tolerance. When the ERASE pin is tied high during less than 100 ms, it is not taken into account. The pin must be tied high during more than 220 ms to perform a Flash erase operation.
    The ERASE pin is a system I/O pin and can be used as a standard I/O. At startup, the ERASE pin is not configured as a PIO pin. If the ERASE pin is used as a standard I/O, the startup level of this pin must be low to prevent unwanted erasing. Please refer to Section 9.3 “Peripheral Signal Multiplexing on I/O Lines”. Also**, if the ERASE pin is used as a standard I/O output, asserting the pin to high does not erase the Flash.**