CLI flash not working now

I flashed the device earlier ok with firmware update and then a test blink program ok.

Now I wrote another small blink app and when I try to flash I get the really useful debug info below and have no idea what is happening…

! Serial:
Error writing firmware… Transfer cancelled

Is the device in Listening mode?

Your user firmware might be interfering with the flashing process. Personally I find DFU flashing much more preferable since it’s a lot more reliable, as well as giving better error outputs.

1 Like

What is the DFU flashing?

So far I am only aware of flash OTA or by serial using CLI.


I am not sure why the cli stopped flashing, I ended up using OTA yesterday to upload a couple more changes to my little test code. It would not be so frustrating if the cli at least gave a useful message to explain why it the flash process was terminated. A remark like “undefined” has no meaning to me and does not help me find the issue.

That’s what DFU gives you :wink:

To use DFU you need to put your device in DFU mode, and issue particle flash --usb firmware.bin using the CLI. You’ll need to have DFU-Util installed properly though (which should be done for you when using the Windows installer).

I used the CLi yesterday and received the “unknown” error and termination of flashing.

It was therefore DFU that was giving the useless error message.

You mentioned you used Serial. Serial != DFU :wink: The CLI can use either, it’s up to you to decide which one it uses.

I see, I did use DFU to install the latest firmware in the device but then used CLi for flashing new code.

So, If I use DFU mode instead then I will get better error messages?

The CLI can also use DFU, so there’s no separation in that regard.

Indeed it should.

This happened to me when I accidentally compiled for Electron, when I should have compiled for Photon.

// Don’t do this for a Photon…
particle compile electron firmware
particle flash --serial firmware.bin

That is, if you do the above, and try to flash to Photon this error appears:

? Press ENTER when your device is blinking BLUE
sending file: firmware.bin
! serial:
Error writing firmware…Transfer cancelled