🛠 Mises à jour OTA et sauvetage par USB DFU
Objectives
Master the two firmware update methods: wireless update via Particle Cloud (enabled by the 128 KB OTA backup flash zone described in the datasheet's memory map) and USB DFU recovery mode when nothing else works.
Hardware
- 1 Particle Photon claimed on your account (
particle identifydisplays the ID and status) - Particle CLI installed and authenticated (
particle login) - A good USB cable (USB brown-outs are the primary cause of failed flashes)
Complete Code
// photon-ota-dfu.ino — firmware versionne pour tester le canal OTA
// Compilation puis flash OTA :
// particle flash <nom_du_device> .
// ou depuis un binaire compile :
// particle flash <nom> firmware.bin
// Par REST aussi : PUT /v1/devices/<id> avec -d file=@firmware.bin
SYSTEM_THREAD(ENABLED);
void setup {
pinMode(D7, OUTPUT);
Serial.begin(9600);
Serial.println("Firmware v2.0 - canal OTA operationnel");
Serial.println(System.version); // version du Device OS installe
// Recommandation officielle : rester sur la branche 2.x LTS,
// les versions 1.x et 3.x sont en fin de support.
}
void loop {
digitalWrite(D7, HIGH); delay(100);
digitalWrite(D7, LOW); delay(100); // motif rapide = v2
}
Expected Verification
After running particle flash <name> ., the Photon downloads the binary over Wi-Fi, blinks in two colors during writing, then restarts with the new firmware (fast D7 LED, serial trace v2.0). In case of a broken firmware: hold SETUP, press RESET, the LED blinks yellow (DFU mode confirmed by the datasheet), then flash via USB with the appropriate DFU tool to restore a Device OS 2.x LTS.
Common Errors
- Launching an OTA on poor Wi-Fi: risk of getting stuck in magenta, as described by the community; USB DFU is then the escape route.
- Confusing DFU mode (blinking yellow, SETUP+RESET) and listening mode (cyan, long SETUP): the first one flashes, the second one configures Wi-Fi.
- Overwriting the DCT unknowingly: the DCT table contains device keys and Wi-Fi credentials, it is flashed separately.
- Staying on Device OS 3.x or 1.x: out of support, the datasheet recommends 2.x LTS.
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-evenement.inoArduinofonction-distance.inoArduinocapteur-dht.inoArduinoruban-neopixel.inoArduinopwm-respiration.inoArduino