Ma stai usando la "native port" oppure la programming port ?
Sulla native port devi prima aprire la comunicazione a 1200 bps per avviare il soft erase, poi programmi nel solito modo, con la programming port non devi fare nulla, ci pensa l'interfaccia ad avviare l'erase.
Dalla guida di Arduino DUE:
Opening and closing the ''Native' port at the baud rate of 1200bps triggers a “soft erase” procedure: the flash memory is erased and the board is restarted with the bootloader. If, for some reason, the MCU were to crash during this process, it is likely that the soft erase procedure wouldn't work as it's done in software by the MCU itself.
The Programming port uses a USB-to-serial chip connected to the first UART of the MCU (RX0 and TX0). The USB-to-serial chip has two pins connected to the Reset and Erase pins of the SAM3X. When you open this serial port, the USB-to-Serial activates the Erase and Reset sequence before it begins communicating with the UART of the SAM3X. This procedure is much more reliable and should work even if the main MCU has crashed.