LinuxCommandLibrary

dfutool

Flash firmware to DFU-capable devices

SYNOPSIS

dfu-util [options]

PARAMETERS

-l, --list
    Lists all currently connected DFU-capable devices and their properties.

-d, --device vendor:product[,vendor:product...]
    Specifies the target DFU device by its USB Vendor ID (VID) and Product ID (PID). Multiple devices can be specified.

-a, --alt alt_setting
    Selects a specific alternate interface setting for the DFU operation. This is crucial for devices with multiple memory regions.

-i, --interface interface_number
    Specifies the DFU interface number to use, useful for devices with multiple DFU interfaces.

-s, --serial [serial_string|serial_number]
    Selects the device based on its USB serial number or string, useful when multiple identical devices are connected.

-p, --path bus-port.port...
    Selects the device by its physical USB bus and port path, for precise device targeting.

-U, --upload filename
    Uploads (reads) firmware from the DFU device and saves it to the specified filename.

-D, --download filename
    Downloads (writes) firmware from the specified filename to the DFU device. The file should be in a DFU-compatible format (e.g., .dfu, .bin).

-R, --reset
    Resets the device after the DFU operation (upload or download) completes, often taking it out of DFU mode.

-v, --verbose
    Enables verbose output, providing more detailed information about the DFU process for debugging.

DESCRIPTION

The dfutool, most commonly referring to the widely used open-source utility dfu-util on Linux, is a powerful command-line tool designed to communicate with devices that support the USB Device Firmware Upgrade (DFU) protocol. This protocol enables in-system programming of firmware, allowing users to update, upgrade, or recover the firmware on microcontrollers and embedded systems directly over a standard USB connection. dfu-util provides essential functionalities such as uploading (reading) firmware from a device, downloading (writing) new firmware to it, erasing device memory, and listing available DFU-capable devices. It is an indispensable tool in embedded systems development, rapid prototyping, and field maintenance, offering a flexible and standardized method to manage device firmware without requiring specialized JTAG/SWD programmers or debuggers beyond a simple USB cable. Its broad adoption makes it compatible with numerous microcontrollers, including those from STMicroelectronics, Atmel, and others.

CAVEATS

The term dfutool can sometimes refer to vendor-specific or proprietary Device Firmware Upgrade utilities (e.g., for Cypress or Microchip devices), which may have different syntax and functionalities compared to the general-purpose dfu-util. Users should verify which specific tool is intended.
For dfu-util to function correctly, proper USB device permissions are required, often configured via udev rules or by running the command with superuser privileges (e.g., using sudo). Without correct permissions, devices may not be detected or accessible.
Using incorrect or corrupted firmware images can potentially 'brick' a device, rendering it inoperable. Always ensure the firmware file is compatible and verified for your specific hardware.

DFU MODE

For dfutool (or dfu-util) to interact with a device, the device must first be placed into its specific DFU mode. This often involves a particular hardware procedure, such as holding down a 'boot' button during power-up, shorting specific pins, or issuing a software command that triggers a reset into DFU mode. The exact method for entering DFU mode varies significantly between device manufacturers and models and is crucial for successful firmware operations.

HISTORY

The USB Device Firmware Upgrade (DFU) specification was developed by the USB Implementers Forum to standardize in-field firmware updates over USB. The open-source dfu-util project emerged to provide a cross-platform, free implementation of this protocol. It began development around 2007 and has since become a cornerstone tool for embedded systems development, particularly in the open-source community, complementing or replacing proprietary DFU tools. It continues to be actively maintained and updated to support new DFU specifications and device implementations.

SEE ALSO

udev(7), lsusb(8)

Copied to clipboard