Program an nRF52840 Dongle Without a Debug Probe
Flash an nRF52840 Dongle over USB with nrfutil, the built-in bootloader and a DFU package, without a debug probe, then recover it back into bootloader mode.

The nRF52840 Dongle looks like a USB stick, costs little and carries the full nRF52840. It also has no on-board debugger, so the usual west flash path through a J-Link does not work. What it has instead is a USB bootloader that Nordic programs at the factory. With that bootloader, the dongle accepts firmware over its own USB port, from a signed-free development package built with nrfutil. This post covers the whole loop on the nRF Connect SDK v2.9: building for the dongle board, packaging the image, entering the bootloader, flashing and reading output. The bootloader behaviour is documented in Nordic's nRF52840 Dongle user guide.
How the dongle differs from a development kit
A development kit has a second chip that acts as the debugger. The dongle does not, so the only ways to put code on it are:
The factory USB bootloader, which accepts a DFU package over a virtual serial port. This is the path for this post.
An external debug probe wired to the SWD pads on the dongle's edge, which gives full debugging at the cost of soldering or a clip.
The bootloader sits at the top of flash. It occupies the top of the address space, so applications for the dongle must be linked to start above the bootloader's lower bound, and must leave the bootloader and its settings alone. Zephyr's board definition for the dongle, nrf52840dongle/nrf52840, takes care of the flash layout, giving the application the memory below the bootloader and starting it at an offset because the dongle's bootloader begins with the Nordic MBR, the Master Boot Record, at address 0.
Build for the dongle
Take the blinky from the first-application post, or any sample, and build for the dongle board:
west build -b nrf52840dongle/nrf52840 -p alwaysThe build produces build/zephyr/zephyr.hex. The dongle has a green LED and a red-green-blue LED, and the board file maps led0 to the green one. Check that your application uses an LED alias that exists for this board, because the dongle has no buttons wired the way the development kit does, other than the single user button next to the reset button, aliased sw0.
Package the image
The bootloader does not accept a raw hex file. It accepts a ZIP archive with the firmware and a manifest, produced by nrfutil. Install the nRF Util nrf5sdk-tools command, which contains the packaging for this bootloader:
nrfutil install nrf5sdk-toolsThen generate the package. The key arguments are the hardware version, the SoftDevice requirement and the application version:
nrfutil nrf5sdk-tools pkg generate \
--hw-version 52 \
--sd-req 0x00 \
--application build/zephyr/zephyr.hex \
--application-version 1 \
blinky_dongle.zip--hw-version 52 identifies the nRF52 family. --sd-req 0x00 says the application does not require any SoftDevice, which is right for a Zephyr application, since Zephyr's Bluetooth controller is not a SoftDevice in the sense the bootloader checks. --application-version is an integer that you increase with each release. The command writes blinky_dongle.zip and prints its contents summary.
Zip created at blinky_dongle.zipThe ZIP contains zephyr.hex converted to a binary, a .dat file with an init packet describing it and a manifest.json. The development package is unsigned, and the factory bootloader accepts unsigned packages. Production devices can be provisioned with a bootloader that requires signatures, which is a separate step and a separate bootloader image.
Enter the bootloader
The bootloader runs when the dongle powers up with the RESET button pressed, or when the application asks it to. Press the small button on the side labelled RESET (the one at the edge, next to the USB end, not the user button) once while the dongle is plugged in, and the red LED starts to pulse. That pulsing red LED means the dongle is in DFU mode, and a serial port appears on your computer. Nordic's user guide describes this behaviour for the dongle.
List the serial ports to find it:
nrfutil device listE3A1B2C4D5E6
Product Open DFU Bootloader
Ports /dev/ttyACM0
Traits nordicDfu, serialPorts, usbThe serial number and port are examples, and yours differ. The nordicDfu trait shows the device is in bootloader mode.
Flash the package
Give the package and the port to the DFU command:
nrfutil nrf5sdk-tools dfu usb-serial -pkg blinky_dongle.zip -p /dev/ttyACM0The tool sends the init packet and then the firmware in blocks, with a progress bar:
[####################################] 100%
Device programmed.When it finishes, the dongle resets, leaves the bootloader and runs your application. The green LED begins to blink. The dongle's serial output, if your application has a USB CDC console configured, appears as a new serial port that the application itself exposes. Without that configuration there is no printk output, because the dongle does not route the UART to a header the way the kit routes it to a USB bridge.
Console over USB CDC
Because the dongle has no UART bridge, send the console over the nRF52840's own USB peripheral with a CDC ACM serial port. Add these options to prj.conf:
CONFIG_GPIO=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="SC dongle"
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_CONSOLE=yand select the CDC ACM instance as the console in an overlay file named nrf52840dongle_nrf52840.overlay in the application folder, or in Zephyr's cdc_acm_uart0 snippet if your SDK version offers it:
/ {
chosen {
zephyr,console = &cdc_acm_uart0;
};
};
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};With the overlay, the application's printk and logging go to a USB serial device named after CONFIG_USB_DEVICE_PRODUCT. After flashing, a new port appears and a terminal shows the output:
*** Booting nRF Connect SDK v2.9.0-... ***
Blinky running on nrf52840dongle/nrf52840Zephyr's USB API changed between releases, with the older CONFIG_USB_DEVICE_STACK and the newer USB device stack next, so check the options against the SDK version you use, using menuconfig to find the equivalent names.
Getting back into the bootloader
If your application crashes or hangs, you re-enter DFU mode with the RESET button as above. If your application uses USB and a bug locks the USB interface, the bootloader is still safe, since it lives in its own region. What you must never do is erase or overwrite the bootloader region. A write with an external programmer that wipes the whole chip, including the MBR and bootloader, leaves a dongle that no longer enumerates and needs an SWD probe to restore. Using the DFU path never touches the bootloader.
Debugging with SWD when you need it
The dongle breaks out the SWD signals on pads near the edge, labelled SWDIO and SWDCLK, with a footprint for a 1.27 mm header on the board's back. Connect these, with reset and ground and a supply voltage reference, to a J-Link or to the debug-out port of a development kit. With that connection, west flash and west debug work, but you must build with the layout that does not rely on the bootloader if you intend to replace it. Most people never need this for the dongle, and use it as a cheap target and a sniffer.
When the dongle is the wrong tool
A dongle has no debugger, so anything that needs breakpoints, a power measurement or RTT logging is better done on a development kit. Its LEDs and the single button are the only user I/O, and its pins are limited to the ones broken out at the edge. For product prototyping, use a development kit or a custom board with an SWD header. Use the dongle to deploy a finished firmware, as a Bluetooth sniffer for the nRF Sniffer tool, or as a USB radio for a PC application.


