Best way to use System.dfu();

My prototype using eserie module will be seal up in a IP67 enclosure.
I am looking clean way to program/flash it when it’s installed somewhere that won’t be easy access.

When I will be at my workbench I will open the casing to have access to the entire PCB.
That is not the issue here. On my PCB I have USB and reset and mode button.

I have a 24 pin connectors to bring signal inside my enclosure. I routed the USB (data+,Data-, USB power, GND) and the RESET and MODE button. This mean, that will have access to USB and will be able to put my enclosure in DFU. I think with that, I am ready to rock and roll. (In production, I won’t have any of that.)

During my googling, I found 2 ways that I could also use.

Have a button that place the entire module in DFU


I save 1 input on my 24 pin connector and the hassle of DFU sequence.
I tried this and it works great and would recommend people to give this a try. On an interrupt it would be even better.

Also for development I could use my phone to set the module in DFU

Particle.function("SetDFU", funcDFU);

int funcDFU(String extra) {
     return 0;

so like this I could save 2 input on my 24 pin connector. I remove RESET and MODE.
I could but RESET in a function if things don’t work or simply power cycle.

Do you guys have more ideas?

I would not leave this in production, just for development.
I also read on this forum that one day particle will have a automatic DFU mode.

With access to the USB port, you can also force DFU mode two more ways:

  • Connect by USB serial at 14400 baud. This will force the device into DFU mode.
  • Use a USB control sequence to enter DFU (in 0.8.0 and later).
1 Like

ok, I tried it.

I open tera term, set the baud to 14400 and boom it when into DFU.
Ok cool, it’s an option.

regarding the USB control sequence you link, well I have no clue what that is. Is that something dedicated to USB and not related to particle. Like a library for communication to USB devices. And you make a lib with special command to control the particle.

I think I can live without this last option.


USB vendor/control requests are something common to USB devices but only recently Particle added that feature to their devices.
CLI 1.40.0 now supports these requests (however, for Windows new drivers are required and are currently tested).

C:\>particle usb --help
Control USB devices
Usage: particle usb <command>
Help:  particle help usb <command>

  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

ah thanks!

C:\.particle\blink_LED\blinkblink>particle version

so I have the correct version.

you said

(however, for Windows new drivers are required and are currently tested).

Then that explain why it does not work

C:\.particle\blink_LED\blinkblink>particle usb dfu

C:\.particle\blink_LED\blinkblink>particle usb list

At least I know how this works now. Will try in the future. Thanks again!