Flashing Locally on Photon - Difference between --serial and --usb

In the Documentation I see two ways of Flashing locally.

  1. Compiling remotely and flashing locally
  2. Flashing your program locally via USB

Both if these work for the Photon. However only #2 is listed for the Photon and #1 is listed for the Electron. So my questions are:

  1. What is the difference (to my Photon) if any?
  2. Which one is the recommended way for the Photon?
  3. What am I missing or is it just that that documentation needs to be updated?

Flashing with -usb uses dfu-util to upload code to your device. Your device must be in dfu mode (flashing yellow) to accept firmware.

Flashing with -serial is only available for the Electron I believe, and the Electron must be in listening mode (breathing blue) to accept firmware. It does so by opening a serial port and sending the firmware without requiring dfu-util to be installed on your computer.

Flashing with -usb using dfu-util is seen as the “correct” way for flashing firmware. It is more reliable, and all Particle devices can go into dfu mode and accept firmware.

I think the docs just need to be updated.

Nope, this also works for the Photon (both versions should work on all Particle devices).
But I'd always go for DFU Mode flashing via particle flash --usb firmware.bin since --serial always reports success on any file that can be sent (irrespective of its content) but --usb gives you proper feedback whether this was a suitable file and if the code got flashed OK.

Thank you @nrobinson2000 and @ScruffR for your replies. So I guess the docs need to be updated and using DFU is the better choice (if one has the DFU Utility installed and working).

I had an issue yesterday where I used method #1 (listen mode and Serial) and it seemed like the device was flashed OK, but things didn’t work as expected. @ScruffR, your answer explains why.

2 Likes