This is an old revision of the document!


Table of Contents

dfu-util

dfu-util can be used to communicate with DFU (device firmware upgrade) enabled devices.

Examples include the Leaflabs Maple mini boot loader and the Longan Nano.

Be sure to have the latest version installed from at least 2020 if you intend to use the Longan Nano which may not work correctly otherwise.

Install

git clone https://git.code.sf.net/p/dfu-util/dfu-util dfu-util
cd dfu-util
sh autogen.sh
./configure --prefix=/usr/local
make -j 4
make install

Usage

$ dfu-util
dfu-util 0.11-dev

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

You need to specify one of -D or -U
Usage: dfu-util [options] ...
  -h --help                     Print this help message
  -V --version                  Print the version number
  -v --verbose                  Print verbose debug statements
  -l --list                     List currently attached DFU capable devices
  -e --detach                   Detach currently attached DFU capable devices
  -E --detach-delay seconds     Time to wait before reopening a device after detach
  -d --device <vendor>:<product>[,<vendor_dfu>:<product_dfu>]
                                Specify Vendor/Product ID(s) of DFU device
  -n --devnum <dnum>            Match given device number (devnum from --list)
  -p --path <bus-port. ... .port>       Specify path to DFU device
  -c --cfg <config_nr>          Specify the Configuration of DFU device
  -i --intf <intf_nr>           Specify the DFU Interface number
  -S --serial <serial_string>[,<serial_string_dfu>]
                                Specify Serial String of DFU device
  -a --alt <alt>                Specify the Altsetting of the DFU Interface
                                by name or by number
  -t --transfer-size <size>     Specify the number of bytes per USB Transfer
  -U --upload <file>            Read firmware from device into <file>
  -Z --upload-size <bytes>      Specify the expected upload size in bytes
  -D --download <file>          Write firmware from <file> into device
  -R --reset                    Issue USB Reset signalling once we're finished
  -w --wait                     Wait for device to appear
  -s --dfuse-address address<:...>      ST DfuSe mode string, specifying target
                                address for raw file download or upload (not
                                applicable for DfuSe file (.dfu) downloads).
                                Add more DfuSe options separated with ':'
                leave           Leave DFU mode (jump to application)
                mass-erase      Erase the whole device (requires "force")
                unprotect       Erase read protected device (requires "force")
                will-reset      Expect device to reset (e.g. option bytes write)
                force           You really know what you are doing!
                <length>        Length of firmware to upload from device

Probe

Longan Nano
$ sudo dfu-util -v -l
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [28e9:0189] ver=0100, devnum=45, cfg=1, intf=0, path="1-1.2", alt=0, name="@Internal Flash  /0x08000000/128*001Kg", serial="3CBJ"
Maple Mini
sudo dfu-util -l -v
dfu-util 0.11-dev

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

libusb version 1.0.22 (11312)
Found DFU: [1eaf:0003] ver=0201, devnum=54, cfg=1, intf=0, path="1-1.1.3", alt=0, name="DFU Program RAM 0x20000C00", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=54, cfg=1, intf=0, path="1-1.1.3", alt=1, name="DFU Program FLASH 0x08005000", serial="LLM 003"
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies