Unable to flash Electron over Serial USB

Hey everyone, hopefully someone can help me out. I have my Electron setup and claimed. I’ve gotten it to successfully connect to cell tower and getting breathing magenta, Yay!

My problem is that I can’t flash to the Electron over serial usb. What I have tried so far:

  1. Download the binary for Electron from the build IDE
  2. Place Electron in Listening mode while connected to computer
  3. Run: particle flash --serial firmware.bin

After this I get an error:

Including:
    firmware.bin
attempting to flash firmware to your device --serial
Flash device failed
I didn't recognize that device name or ID, try opening https://api.particle.io/v1/devices?access_token=###MYUNIQUETOKEN#####

If I go to that link, It displays this JSON response:

[
{
“id”: “#######”,
“name”: “Xamarin”,
“last_app”: null,
“last_ip_address”: “50.150.98.9”,
“last_heard”: “2015-12-16T19:06:53.752Z”,
“product_id”: 6,
“connected”: false,
“platform_id”: 6,
“cellular”: false,
“status”: “normal”
},
{
“id”: “######”,
“name”: “Motorcycle”,
“last_app”: null,
“last_ip_address”: “176.83.162.171”,
“last_heard”: “2016-03-03T19:49:40.326Z”,
“product_id”: 10,
“connected”: false,
“platform_id”: 10,
“cellular”: true,
“status”: “safe-mode”,
“last_iccid”: “######”,
“imei”: “########”
}
]

So the Electron is there and identified properly. I verified that the device shows up in the Particle App and I can see when it’s connected or not. I have also updated my particle CLI, reflashed tinker and started the process over again with no different results. I have also tried putting the Electron in DFU instead of listening mode, but same results.

I’m sure I’m missing something simple and small. Hoping someone can just point out the obvious to me.

Could you try ‘particle serial list’ when in listening mode?

yup

michaelw-mac:Downloads michaelw$ particle serial list
Found 1 device connected via serial:
/dev/cu.usbmodem141341 - Electron
michaelw-mac:Downloads michaelw$

What would also be the difference between “serial” and “usb”?

I’m assuming when we flash over USB with tinker, that is different then flashing the binary over serial. I am newer to working on this stuff, but my understanding is that my binary will sit on top of Tinker.

I ask this because I know I can flash it over usb, but not serial.

Hmm, Tinker doesn't flash anything. Tinker is either the mobile app, or the corresponding firmware on the device. The app can only flash the Tinker firmware, and does so OTA.

USB vs SERIAL would be a matter of protocols I believe. Serial uses, well, serial, whereas your 'usb' uses DFU.

It won't. Tinker is just another firmware application, that'll be overwritten as soon as you flash anything new to it. The app will then no longer be able to control the pins, since it needs the corresponding firmware to do that.

1 Like

Interesting, so I can just use --usb if that works for me?

Sure, I wouldn’t know why not :slight_smile:

Great! thanks for the info

I have the same type of problem (I’m not sure if this is the right way to post for help). I’m using Windows 10. No problem with setup, flashing OTA, or using USB serial port (COM3) from my app. particle serial list shows my electron on COM3
node v shows v0.10.29 npm -v shows 1.4.14. particle flash --serial firmware.bin gives me this error:

C:\Users\erhughes1944\Downloads>particle flash --serial firmware.bin
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: firmware.bin

! serial:
Error writing firmware...TypeError: Cannot call method 'copy' of undefined
TypeError: Cannot call method 'copy' of undefined
    at Function.Buffer.concat (buffer.js:499:9)
    at Object.YModem._sendPacket (C:\Users\erhughes1944\AppData\Roaming\npm\node_modules\particle-cli\lib\ymodem.js:179:20)
    at Object.YModem._sendFileHeader (C:\Users\erhughes1944\AppData\Roaming\npm\node_modules\particle-cli\lib\ymodem.js:173:15)
    at start (C:\Users\erhughes1944\AppData\Roaming\npm\node_modules\particle-cli\lib\ymodem.js:147:17)
    at runTask (C:\Users\erhughes1944\AppData\Roaming\npm\node_modules\particle-cli\node_modules\when\pipeline.js:37:16)
    at C:\Users\erhughes1944\AppData\Roaming\npm\node_modules\particle-cli\node_modules\when\pipeline.js:42:12

Help. I’m sure its something easy I’m missing.

Try updating your node - 0.10.29 is really old and known not to play well here
Don’t use any version < 4.x.x

Be sure that you don’t have debugging enabled, since this data is also sent over serial, which breaks the serial file transfer protocol.
The best way to disable debugging is to put the device in safe mode, or flash factory tinker.

thanks. new version did it. v4.3.2. I’m really happy with my electron. Took a while (1/2 day) for OTA to show up in dashboard or maybe there’s a threshold. First reading is 0.07MB. thanks again.

2 Likes

Same trouble as Dr. Watson.

Replace --serial with --usb in command line flash instruction in particle cli? Is that what worked?

Thank you for such a good description of the problem.

I’ve been using what the documentation shows with no issue over USB to the Electron on Win 7

particle flash --serial firmware.bin

Both of my Electrons have this same failure. I'm unable to flash Electron over Serial USB.

I'm on macOS (Yosemite).

Electrons are in listening mode. Electrons registered, recognized, listed in particle-cli.

Silver-Palace:Downloads w5nyv$ particle flash --serial firmware.bin
Including:
firmware.bin
attempting to flash firmware to your device --serial
Flash device failed
I didn't recognize that device name or ID, try opening https://api.particle.io/v1/devices?access_token=[verified]
Silver-Palace:Downloads w5nyv$

Ok, so I checked this page, and the device is reporting.

  {
    "id": [verified],
    "name": "american-boy",
    "last_app": null,
    "last_ip_address": "176.83.137.110:11237",
    "last_heard": "2016-03-28T18:20:36.938Z",
    "product_id": 10,
    "connected": true,
    "platform_id": 10,
    "cellular": true,
    "status": "normal",
    "last_iccid": [verified],
    "imei": [verified],
    "current_build_target": "0.4.8"
  }

What next to try?

Fixed!

Needed to update particle-cli

sudo npm update -g particle-cli

Found this tip here: Electron: Flashing via USB serial fails