🛠 Sauver une Due invisible : bouton Erase, SAM-BA et bossac en secours
Objectives
Counter-intuitive but documented: unlike AVR boards, the SAM3X must ERASE its flash before any re-programming when a sketch is already running. Normally, the IDE handles this via the 1200 baud command (the "touch" that drops the board back into the sam-ba bootloader). But when the board becomes invisible — no Programming port, no Native port, a runaway sketch that disables USB at startup — you need the manual procedure: Erase button + bossac or SAM-BA. This tutorial is the anti-panic insurance for all others.
Hardware
- 1 Arduino Due (or clone) that has become unfindable or refuses to upload
- Micro-USB data cable on the Programming port
- Arduino IDE (SAM core) or arduino-cli; as a last resort, the Atmel/Microchip SAM-BA tool (the SAM3X ROM monitor is present on the UART of the Programming port)
- The ERASE button is on the board, next to the RESET button (and the JTAG connector)
Complete code
Procedure 1 — reprogrammation manuelle au bouton Erase
1. Brancher le port Programming au PC ; verifier qu'un port serie apparait.
2. Maintenir le bouton ERASE enfonce.
3. Tout en maintenant ERASE, lancer Televerser dans l'IDE.
4. Relacher ERASE quand la progression demarre (le bootloader efface
puis ecrit). Le sketch precedent est perdu, le nouveau prend la main.
Procedure 2 — bossac en ligne de commande (equivalent de l'IDE)
bossac --port COM7 -b -e -R -U flash:w:sketch.bin:i
# -b reset vers le bootloader, -e efface la flash, -R relance apres ecriture
Procedure 3 — carte totalement invisible (bootloader brické)
1. Tester un autre cable (la cause n°1 reste le cable de charge seule).
2. Sur les clones, verifier la puce du port Native : televerser via
Programming (16U2 ou equivalent), le Native peut etre inerte.
3. En dernier recours, lancer SAM-BA sur l'UART du port Programming
(moniteur ROM present a l'adresse 0x00030000 du SAM3X) et effacer
la flash depuis l'outil, puis re-téléverser normalement.
4. Le connecteur JTAG permet aussi une reprise par sonde (OpenOCD).
Sketch de test « je suis vivant » a televerser apres recuperation :
void setup {
pinMode(13, OUTPUT);
Serial.begin(115200); // port Programming
SerialUSB.begin(115200); // port Native
Serial.println("Due recuperee !");
}
void loop {
digitalWrite(13, HIGH); delay(100);
digitalWrite(13, LOW); delay(100);
Serial.print(".");
}
Expected verification
After procedure 1 or 2, the upload completes without bossac errors, and the test sketch makes LED 13 blink rapidly while writing dots to the Programming port. In procedure 3, SAM-BA detects the SAM3X on the UART (baud rate 1300000 or the one suggested by the tool) and erases it; the board then reappears in the IDE.
Common errors
- Releasing ERASE too early: the erase does not start, the upload falls back to timeout; hold the button until the progress actually starts.
- Confusing RESET and ERASE: RESET only restarts, it is ERASE that empties the flash — the SAM3X refuses to write over a valid program without prior erasure.
- Persisting with the Native port on a clone: many clones do not have the real SAM3X USB controller; the Programming port is the official fallback path.
- Blaming the board before the cable: a large portion of "bricked Dues" are charge-only cables or poorly powered USB hubs.
- A sketch that cuts USB at startup (sleep, hardware error) makes the Native port mute: this is precisely the use case for the Erase button, do not deduce that the flash is dead.
- In SAM-BA, selecting the wrong memory target or erasing the bootloader area without reloading it: normal IDE upload does NOT rewrite the bootloader; if it is lost, reload it via SAM-BA or JTAG using the binary provided by ArduinoCore-sam.
- Forgetting to select "Arduino Due (Programming Port)" after recovery: the IDE still points to the old, disappeared port.
Other tutorials for this board
- Faire clignoter la LED de l'Arduino Due et apprivoiser ses deux ports USB
- Lire un potentiomètre avec le vrai ADC 12 bits de la Due
- Allumer une LED externe en respectant les broches 3,3 V et 9 mA de la Due
- Générer une vraie tension analogique avec les DAC 12 bits (broches 66 et 67)
- Dialoguer avec un GPS (ou tout module TTL) sur Serial1 sans bloquer la boucle
- Scanner les deux bus I2C de la Due (Wire sur 20/21, Wire1 sur 70/71)
Code examples for this board
clignotante.inoArduinobouton-led.inoArduinodac-onde.inoArduinoadc-12-bits.inoArduinopwm-12-bits.inoArduinogps-serial1.inoArduino