Get started with Zephyr on the nRF52840 Dongle

Congratulations on your nRF52840 Dongle, your compact Swiss army knife for Bluetooth LE

Zephyr RTOS

Zephyr RTOS is an open-source scalable real-time operating system (RTOS) for connected and resource-constrained devices. In addition to its robust kernel, it comes with all the components needed to build a product’s firmware.

These components include things like peripheral drivers, file systems, crypto and security libraries, device management with firmware update support, Internet protocol stacks, and wireless communication stacks like Bluetooth Low Energy, Bluetooth mesh, and so on.

Having all crucial components delivered through one platform reduces development time, hence reducing time to market. These components are compiled in if explicitly enabled, and completely ignored otherwise, giving you full control of the generated binary size.

Key Features

  • Open-source RTOS

  • Robust Kernel

  • Batteries included

  • Highly configurable, highly modular

Get started 

The nRF52840 Dongle is a small, cost-effective USB dongle that supports Bluetooth 5.3, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT, and 2.4 GHz proprietary protocols.

The nRF52840 Dongle is your compact Swiss army knife for Bluetooth Low Energy development. You could use it to inspect Bluetooth Low Energy packets over the air, monitor the Bluetooth LE frequency channels, and test Bluetooth LE connection and connection-less communications through a GATT/GAP roles emulator. Or you could simply flash it with your own custom application. In the following paragraphs, we will show you how to do all of that.  

It contains the following interfaces: 

  • 15 GPIO available via edge castellation
  • USB interface direct to nRF52840 SoC
  • Integrated 2.4 GHz PCB antenna
  • 1 user-programmable button
  • 1 user-programmable RGB LED
  • 1 user-programmable LED

You can develop code for the nRF52840 Dongle either using Zephyr or using nRF Connect SDK which includes all the samples from Zephyr in addition to other Nordic-specific features, libraries, and full-fledge applications like nRF Desktop.  



Since the dongle does not have a debugger onboard, it is factory-programmed with a bootloader from Nordic’s nRF5 SDK. 

You’ll need to install Nordic’s nrfutil program to create firmware packages supported by this bootloader and flash them to the device. Make sure nrfutil is installed before proceeding. 

Install nrfutil , which is a Python package, by typing:

pip install nrfutil

Full documentation for nrfutil is available here.


How to build and flash a Zephyr sample on the nRF52840 Dongle

This is almost like flashing any other Zephyr-supported board, except that you first need to put the dongle manually in DFU (Device Firmware Update) mode, and use nrfutil to create a firmware package compatible with the factory-programmed bootloader. 

1. First, put the dongle in DFU mode by simply pressing the RESET button. 


The push-button is on the far side of the board from the USB connector. Note that the button does not face up. You will have to push it from the outside in, towards the USB connector.

The red LED should start a fade pattern, signaling that the dongle is in DFU mode.

2. Build a zephyr sample, we will use the Bluetooth: Peripheral sample  

west build -b nrf52840dongle_nrf52840 zephyr/samples/bluetooth/peripheral

The Peripheral sample demonstrates the Bluetooth LE-Peripheral role. It includes several Bluetooth SIG-defined services such as the Heart Rate Service, Battery Service, and also vendor-specific GATT services.

This will generate the hex file in the subdirectory build/zephyr/

3. Generate the firmware package that is compatible with Nordic’s bootloader

nrfutil pkg generate --hw-version 52 --sd-req=0x00  --application build/zephyr/zephyr.hex --application-version 1

4. Flash the firmware package onto the board 

nrfutil dfu usb-serial -pkg -p /dev/ttyACM0

Note: /dev/ttyACM0 is for Linux; It will be something similar on a macOS and it will be COMx on Windows.

On a successful flash, you should see something like this: 
[####################################]  100%
Device programmed.

5. To test the  Bluetooth LE functionally, download our open-source nRF Toolbox App on you Android or iOS device, and press on Heart Rate as shown in the screenshot below of the app. 

Then, connect to Zephyr Peripheral Sample Long. The received simulated date over Bluetooth Low Energy for both the battery level and heart rate reading are displayed. graphical user interface

These values are generated inside main.c as shown below: 


Note: You could skip steps 1, 3, and 4 and flash the hex file (zephyr.hex) directly on the Dongle using our Programmer application available in the nRF Connect for Desktop

How to use the nRF52840 Dongle as a sniffer

The nRF Sniffer for Bluetooth® LE is a useful tool for debugging Bluetooth Low Energy (LE) applications. It provides a near real-time display of Bluetooth LE packets through Wireshark.

When developing a Bluetooth Low Energy product, knowing what happens over the air can really help you identify and fix issues quickly. The nRF Sniffer for Bluetooth LE  software is installed as an external capture plugin in Wireshark.

text, table 

To use the sniffer, you need to: 

1. Flash the Dongle with the sniffer firmware
2. Add the capture plugin for Wireshark that records and analyzes the captured over-the-air packets.

We will show you how to do these steps: 

Download the firmware of the sniffer from here and extract it somewhere on your local drive. 

Note that the zip file contains the hex files for other boards. The file you are looking for has the name of the dongle: sniffer_nrf52840dongle_nrf52840_4.1.0.hex

Generate the firmware package. This is the package that nrfutil expects to flash the device

Browse to the hex directory:

cd nrf_sniffer_for_bluetooth_le_4.1.0/hex/

Generate the firmware package:

nrfutil pkg generate --hw-version 52 --sd-req=0x00  --application sniffer_nrf52840dongle_nrf52840_4.1.0.hex --application-version 1

Put the Dongle in DFU mode by pressing the RESET button. Note that the button does not face up. You will have to push it from the outside in, towards the USB connector:

The red LED should start a fade pattern, signaling that the Dongle is in DFU is running.

Flash the firmware package onto the board: 

nrfutil dfu usb-serial -pkg -p /dev/ttyACM0

Note /dev/ttyACM0 is for Linux; It will be something similar on a macOS and it will be COMx on Windows.

On a successful flash, you should see something like this : 
  [####################################]  100%
Device programmed.

You could also use the Programmer app available in our nRF Connect for Desktop to flash the dongle with the hex file directly.

To add the capture plugin to Wireshark, follow the steps explained here.

For more information on how to use the sniffer, see complete documentation here.


How to use the nRF52840 Dongle as a GATT/GAP roles emulator

Through the Bluetooth Low Energy application in nRF Connect for Desktop, you can scan, advertise, establish a connection, and even read/write/indicate/notify Bluetooth LE characteristics.

Simply install and open nRF Connect for Desktop  and click on Bluetooth Low Energy application. Then select your nRF52840 Dongle from the left upper menu. If the dongle is not visible in the menu, push the reset button once.

graphical user interface, text

How to use the nRF52840 Dongle as an 2.4 GHz RSSI Viewer

Similarly, you could use the RSSI Viewer application available in nRF Connect for Desktop to show the received signal level in dBm per frequency in the 2400-2480 MHz range. 

This can help you monitor the Bluetooth LE frequency channels. The RSSI Viewer will show all the 2.4GHz devices in the nearby proximity regardless of the protocol being used, however it highlights the 37 Bluetooth Low Energy data channels in blue and the advertising channels in green. 

Read More


Nordic & Zephyr

How Nordic Semiconductor is using Zephyr 

Nordic Semiconductor is a fabless semiconductor company specializing in ultra-low power wireless solutions for the IoT. We ship more than one million Bluetooth Low Energy SoCs every day. Our multiprotocol SoCs support the Bluetooth mesh, Matter, Thread and Zigbee protocols, and these can run concurrently with Bluetooth Low Energy. We also offer the most compact and low-power cellular IoT solution available in the market, supporting the low-power cellular protocols LTE-M and NB-IoT, in addition to GPS.

nRF Connect SDK, Nordic Semiconductor’s main Software Development Kit, is built on top of Zephyr RTOS. It integrates the RTOS and a wide range of full-fledged applications (Ex: Asset Tracker v2, nRF Desktop), samples, application and networking protocols, libraries, hardware drivers, and more.

Nordic Semiconductor chose to base its SDK on the Zephyr RTOS due to its rich ecosystem and its high configurability, and modularity. These offer developers the flexibility to build size-optimized software for memory-constrained devices as well as powerful and complex software for more advanced devices and applications. 

In addition to Zephyr’s rich ecosystem, nRF Connect SDK adds more libraries, networking protocols, and functionalities that are not part of Zephyr. To name a few: multiprotocol support (MPSL), 2.4 GHz proprietary, CryptoCell libraries, nRF9160 modem libraries, and many more. It also supports all our prototyping platforms (Ex: Thingy:91) and reference designs (Ex: nRF Desktop).  

As part of the nRF Connect umbrella, we also offer many tools that aim to improve developers’ productivity and reduce time to market, such as: a 1-click installer experience through the Toolchain Manager which is part of the nRF Connect for Desktop, and developer environments such as nRF Connect for VS Code. We also aim to equip developers with the technical information and the know-how to build tomorrow’s cutting-edge wireless products through our comprehensive Nordic Developer Academy online courses and documentation.