Buying a Nordic Semiconductor nRF52840 Dongle made me very disappointed. I falsely thought it is a nice little USB2.0 pluggable board to get into low power Bluetooth enabled development but the more I dug into it, the more I found it is almost impossible to get any useful value out of it, as it is.

The first thing I tried was nRF Connect for Desktop software and it worked with the board itself, but in the limited capacity, namely as a form of RSSI viewer tool. The Quick Start section that would in my head would be the most beneficial one shows a rather disappointing message: Not supported yet.

Nrf Connect for Desktop showing the nRF52840 Dongle is not supported under it's Quick Start page

Platformio as a starting point

Having the dongle plugged in I started a "Hello World!" plaformio project, the thing that usually works on a random development board that ends up on my workbench. Among the three supported framework options of Adruino Wiring, MBED and Zephyr I intuitively chose Adruino, as it is the one I am the most familiar with. The program compliles but it would not flash it:

AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, nrfjprog, stlink
CURRENT: upload_protocol = jlink
JLinkExe -device nRF52840_xxAA -speed 4000 -if swd -autoconnect 1 -NoGui 1 -CommanderScript "xxx/upload.jlink"
SEGGER J-Link Commander V8.12f (Compiled Feb 12 2025 12:13:07)
DLL version V8.12f, compiled Feb 12 2025 12:12:09


J-Link Command File read successfully.
Processing script file...
J-Link>h
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>loadbin .pio/build/nrf52840_dk/firmware.hex,0x0
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>r
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>q

Script processing completed.

No matter what I tried, on Mac, Linux or Windows, as suggested in the documentation, the message was always the same:

Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.

Switching the protocol from the default jlink to the nrfjprog had similar disappointing result. The code compiles but would hang up on flashing:

nrfjprog --chiperase --reset --program .pio/build/nrf52840_dk/firmware.hex

Zephyr as a next step

Another thing I tried was this answer as it looked like exactly what I wanted: specific way to use platformio to flash nRF52840 Dongle. It utilizes a hand-crafted python script for flashing which is fine by itself, but it also utilizes something I was not familiar with. A Zephyr framework.

But looking around the internet, many sources hint at a fact that Nordic and Zephyr go well together and that the documentation is great. I just wanted to at least find a way to get this damn thing flashed with my own code, so I did. The results were unsatisfactory again.

Compiling .pio/build/nrf52840_dongle/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from /Users/peterbabic/.platformio/packages/framework-zephyr/include/kernel_includes.h:41,
                 from /Users/peterbabic/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from /Users/peterbabic/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /Users/peterbabic/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:9:
/Users/peterbabic/.platformio/packages/framework-zephyr/include/sys/kobject.h:36:10: fatal error: kobj-types-enum.h: No such file or directory

*******************************************************************************
* Looking for kobj-types-enum.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:kobj-types-enum.h"
* Web  > https://registry.platformio.org/search?q=header:%1B%5Bm%1B%5BKkobj-types-enum.h
*
*******************************************************************************

 #include <kobj-types-enum.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/nrf52840_dongle/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1

Search led me to another answer that in step 5 suggest that Python 3.12 and above does not come with setuptools installed.

brew install python-setuptools

Running plaformio now yet again fails successfully:

Compiling .pio/build/nrf52840_dongle/src/main.o
Archiving .pio/build/nrf52840_dongle/zephyr/kernel/libkernel.a
Indexing .pio/build/nrf52840_dongle/zephyr/kernel/libkernel.a
src/main.cpp:1:10: fatal error: zephyr/kernel.h: No such file or directory
 #include <zephyr/kernel.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
Archiving .pio/build/nrf52840_dongle/zephyr/libzephyr.a
*** [.pio/build/nrf52840_dongle/src/main.o] Error 1
Indexing .pio/build/nrf52840_dongle/zephyr/libzephyr.a

I tried modifying the source code by removing the zephyr/ prefix like this:

-#include <zephyr/kernel.h>
+#include <kernel.h>

And this was even in spite of this answer. This changed the error message but would not compile either:

Compiling .pio/build/nrf52840_dongle/src/main.o
src/main.cpp: In function 'int main()':
src/main.cpp:15:10: error: 'gpio_is_ready_dt' was not declared in this scope
     if (!gpio_is_ready_dt(&led)) {
          ^~~~~~~~~~~~~~~~
src/main.cpp:15:10: note: suggested alternative: 'gpio_pin_set_dt'
     if (!gpio_is_ready_dt(&led)) {
          ^~~~~~~~~~~~~~~~
          gpio_pin_set_dt
*** [.pio/build/nrf52840_dongle/src/main.o] Error 1

This was something that created a hard stop for me as neither google nor Claude 4 did provide any more hints how to proceed and of course something was completely wrong with my setup if the officially supported method from the Zephyr documentation is unavailable in the code.

Using nrfutil manually

Looking at the table lists nRF52840 Dongle as the only board out of 10+ listed there to use the Programming with Nordic Secure DFU method exclusively. Sigh.

The above appears to be further confirmed by the message stating:

Note: This is the primary programming method for the nRF52840 Dongle. Programming an nRF52840 Dongle requires installing the nrf-device-lib driver.

Okay, I installed all the tools and tried flashing the firmware platformio generated manually:

nrfutil device program --firmware .pio/build/nrf52840_dk/firmware.hex --serial-number DC22853847E1

Of course it would not work:

[00:00:00] ------   0% [DC22853847E1] Failed, Firmware file extension .hex is not supported
Error: One or more program tasks failed:
 * DC22853847E1: Firmware file extension .hex is not supported (Argument)

Converting the .hex firmware to something supported should, according to this tutorial be possible by nrfutil pkg but nrfutil search pkg shows nothing.

$ nrfutil pkg
Error: nrfutil command `pkg` not found. See `nrfutil list` for full list of installed commands, `nrfutil search` for installable commands, and `nrfutil install` for installation of new commands.

Caused by:
    Subcommand nrfutil-pkg not found

$ nrfutil search pkg
Found 0 installable command(s)

Go figure. Just for reference, I am adding a version here:

nrfutil 8.0.0 (54d8087 2025-01-07)
commit-hash: 54d8087a38b73b6e56942fb1b024b62365f06731
commit-date: 2025-01-07
host: aarch64-apple-darwin
build-timestamp: 2025-01-07T14:24:48.421941000Z
classification: nrf-external

My options are getting thinner.

Using the GUI Programmer

According to this guide again it should be possible to use nRF Connect GUI Programmer to securely flash the firmware, but that did not work for me either: nRF Connect for Desktop GUI Programmer interface with Write button grayed out

As you can see, the "Write" button is grayed out. I have no idea why.

Standalone Zephyr

There appears to be more warning in this reddit thread about the possibility of easy soft-bricking of the nRF52840 Dongle requiring the actual nRF52840 Development Kit board to unbrick. Well so far I was unable to brick it as I was unable to program any code into it.

There is however one convoluted guide about how to proceed. It involves installing whole Zephyr environment and completely bypasses Platformio. But the guide was actually working. It made my dongle blink.

$ nrfutil nrf5sdk-tools dfu usb-serial -pkg blinky.zip -p /dev/cu.usbmodemDC22853847E11
  [####################################]  100%
Device programmed.

Conclusion for my future self from all of this is this: If you buy a nRF52840, install Zephyr following the official docs and do not use Platformio at all. Enjoy!