Installing DFU-util
Installing DFU-util
This guide explains how to install dfu-util, the utility for programming the flash memory on Particle
devices like the Core, Photon, P1 (with USB) and Electron over USB.
It can be used to program both Device OS and application firmware, and save and restore
configurations.
If you are using Windows, you can use the Windows CLI Installer to automatically install dfu-util
and the CLI rather than using these instructions.
Installation - Windows
The easiest way to install dfu-util under Windows is to use the Particle CLI installer, which installs
it automatically.
Also, you will have to run Zadig for each type of device. In other words, if you have both a Photon
and and Electron, you'll need to run it once in DFU mode for each.
Next is installing the actual dfu-util software. If you are unsure of whether you have 32-bit or 64-
bit windows, this Microsoft knowledge base article on how to tell whether you have a 32-bit or 64-
bit Windows installation may be helpful.
Windows 32-bit
For 32-bit Windows, you will need to download three files from:
http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/win32-mingw32/
Windows 64-bit
Download the dfu-util-0.9-win64.zip file from the dfu-util release site.
You will only need these files from it:
dfu-prefix.exe
dfu-suffix.exe
dfu-util-static.exe
In the Environment Variables window, select Path in the bottom list (System variables) and click
Edit.
In the Edit environment variable window, click New then enter a new row in the table, C:\Program
Files\dfu-util.
After editing the system path environment variable you'll need to restart the computer.
To test it, open a command prompt window and enter the command:
dfu-util -l
There must be a semicolon separating the new item from the previous last item, and then the
path to the directory we just created.
After editing the system path environment variable you'll need to restart the computer or log out
and log back in.
To test it, open a command prompt window and enter the command:
dfu-util -l
And when in normal operating mode or listening mode (blinking blue), the Device Manager looks
like this:
Installation - Mac
Mac - Using homebrew
If you have homebrew installed, it's as simple as running:
brew install dfu-util
The Mac OS CLI Installer tries to install dfu-util if you have homebrew installed.
If you have neither homebrew nor MacPorts installed, I recommend installing homebrew as the
easiest way to install dfu-util. Just follow the instructions on the homebrew site to install it first.
One thing about homebrew: it is designed to run without requiring superuser privileges (su). If
you get a permission denied error, it's probably because your installation has incorrect
permissions. You should stop and fix that first, because all sorts of strange things will continue to
happen until you fix it. This community forum post has more details on how to fix permission
problems with homebrew.
Mac - Using MacPorts
If you use MacPorts you can install it using:
port install libusb dfu-util
Installation - Linux
Most Linux installations have packages for dfu-util already.
If you have Ubuntu, the Linux CLI Installer will try to install dfu-util through apt-get.
Here are the manual install commands for some popular distributions.
Ubuntu and Debian:
sudo apt-get install dfu-util
Fedora:
sudo yum install dfu-util
Arch:
sudo pacman -Sy dfu-util
You will also want to add a udev rule. This allows dfu-util to work without requiring sudo, which is
convenient, and also necessary when using certain CLI and local build commands.
Download the 50-particle.rules file, then copy it to /etc/udev/rules.d.
sudo cp 50-particle.rules /etc/udev/rules.d/
Using dfu-util
A good command to test dfu-util is the -l (list) command. For a Photon, it returns something like
this:
$ dfu-util -l
dfu-util 0.9
Note the addresses are different for the Electron; you should refer to the release notesto find the
addresses to use for your device and Device OS version.
You will often see this warning in the output from dfu-util. It's normal:
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Restoring keys:
dfu-util -d 2b04:d006 -a 1 -s 34 -D keys.bin