Auto detect COM port/force DFU to streamline workflow

I find myself flashing and re-flashing several Particle devices what seems like hundreds of times a day. To make this process less painful i have been using the command mode COM# 14400 to remotely force the device into DFU mode. This has been a godsend for my orcish fingers.

Unfortunately, each time I connect to a new device via USB the COM port changes. I have to check the device manager each and edit my command. :disappointed_relieved:

Is there a way to auto detect the new COM port or use a wildcard of some kind to search? Alternatively, is there another command that will force the device into DFU mode that does not require the specific COM port? This is simply a quality of life improvement to placate my laziness. Any tips would be greatly appreciated.

Thanks

For a while now you can use USB control requests and CLI has got them bundled under particle usb

Usage: particle usb <command>
Help:  particle help usb <command>

Commands:
  list             List the devices connected to the host computer
  start-listening  Put a device into the listening mode
  stop-listening   Make a device exit the listening mode
  safe-mode        Put a device into the safe mode
  dfu              Put a device into the DFU mode
  reset            Reset a device
  configure        Update the system USB configuration

You can even pass the device ID to select a specific device if you had more than one plugged in at the same time.

1 Like

Is there a way to implement this in VSC so that the “Particle: Flash application (local)” command automatically puts the device into DFU mode before flashing it?

With 1.5.0 you should have that already :wink:

2 Likes

@bbrokaw this is what I had to do to stop reassigning the com port numbers. the below is for the E0, but these can be found within the device manager

Issue: USB COM# gets reassigned in Device Manager

Causes: USB driver needs to be set to ignore in the registry.

Need to set Ignore flags for Device VID and PID. Location as below.

  • Create New Binary Value
  • Rename to “IgnoreHWSerNum{VID#}{PID#}”
  • Set value to 01

Amazing! Thank you!

Using 1.5.0, the COM Port is there and selected, I get an error:

Unable to open USB device: LIBUSB_ERROR_NOT_SUPPORTED

What device OS version have you got on your device?
Do you have the lates drivers installed?

If you install these drivers, make sure to tick the remove old drivers checkbox too.

1 Like

Updating the drivers fixed it, Thanks!