Documentation library

nRF5 SDK v15.2.0
DFU Trigger Library (USB)
This information applies to the nRF52840 SoC only.

When the trigger library is added to an application, it allows a connected USB host to remotely tell the app to reboot into the bootloader to allow it to be updated via DFU. When asked to enter bootloader mode, it pulls its own reset pin using the GPIO pin BSP_SELF_PINRESET_PIN (by default, only available on PCA10059). As a consequence, the library requires the following:

  • a GPIO pin connected to the RESET pin which is true for the PCA10059 dongle,
  • a bootloader that enters DFU mode on pin reset.

The experimental Open USB bootloader example is configured in this way, and newer versions of the nRF Connect PC app are equipped to communicate with the Trigger module.

Serial number

We recommend setting the USB serial number with app_usbd_serial_num_generate (see also note below). This allows the host to follow the device as it transitions from application to bootloader, since the bootloaders have the same serial number.

Note
When the Trigger is the only USB class present in the application (i.e. when the NRF_DFU_TRIGGER_USB_USB_SHARED config is 0), the Trigger library automatically calls app_usbd_serial_num_generate.

Protocol

This library is similar to the Runtime part of the USB DFU 1.1 spec, but differs in the following way:

  • Since the DFU mode entered is not USB DFU 1.1 compliant, the interface class has been changed to "Vendor Specific" (0xFF). The subclass and protocol are both 0x01, as in USB DFU 1.1.
  • In addition to the DFU_DETACH request, there are two new requests to retrieve:
    • A human-readable version string with the name and semantic version of the current application.
    • A machine-readable version struct with more information about the firmware and hardware.
Request Opcode Response
DFU_DETACH 0x00 None, reboots into bootloader.
Firmware Info 0x07 Information structure, see app_usbd_nrf_dfu_trigger_nordic_info_t
Version String 0x08 "[application name] [semantic_version]"
The default [semantic version] is "0.1.0+MMM-DD-YYYY-HH-MM-SS", where the timestamp is the time of compilation. The application name and version can be set via sdk_config.