Zephyr Developer Summit

June 8 – 9, 2022

Nordic Semiconductor is a proud Platinum sponsor of the Zephyr Developer Summit 2022. We hosted a variety of talks and hands-on sessions throughout the event days and gave out free hardware (nRF52840 Dongle). 

If you couldn't attend this year's Zephyr Developer Summit, you can find a list below with descriptions and links to technical talks about Zephyr by Nordic.

    Technical talks about Zephyr by Nordic 

  • Zephyr Devicetree Mysteries, Solved - Marti Bolivar

    Devicetree is a foundational part of Zephyr. It is a domain-specific language and data format used throughout the project for describing the hardware a Zephyr application runs on, as well as its initial configuration. Despite its widespread use, however, it is often regarded as a mysterious area, and it can be difficult to diagnose build errors related to devicetree. This talk describes the design and implementation of the Zephyr's devicetree subsystem, going beyond the user-facing API to describe implementation details underlying common confusion.

     

  • Mastering Zephyr Driver Development - Gerard Marull Paretas

    In this presentation, we'll cover a broad range of topics related to Zephyr driver development, including: General guidelines about Zephyr device drivers and best practices, The role of Devicetree and Kconfig in device drivers. Application-specific topics: out-of-tree drivers, custom driver APIs... Hands-on: implementing a real driver.

     

  • Twister V2: New Framework for Testing Based on Pytest. Overview & Current Status - Maciej Perkowski

    The presentation will be focused on Twister v2: the main concepts behind it and the current state of its implementation. A prototype based on pytest will be presented. The goal is to show if/how the pytest-based approach and its tools can be used to create a solid test framework for Zephyr's needs. The audience will be introduced to the process behind Twister v2 and encouraged to contribute to its fulfillment. 

     

  • How to Get Your Zephyr Patches Merged - Carles Cufí & Marti Bolivar

    This talk is for everyone who is interested in contributing code or documentation to Zephyr, and wants to learn how to do so effectively. We'll cover all the details, including: - deciding whether or not to send your contribution upstream - how to structure your contribution - how to create your initial pull request - what to do when you get continuous integration (CI) results - what to do when you get review feedback - how to update your pull request to address CI problems or review comments - what to do when things seem slow Carles and Martí are both longtime Zephyr developers and the release managers for Zephyr v3.1, so they have years of real-world experience both submitting and merging pull requests to Zephyr.

     

  • USB Support in Zephyr OS - Johann Fischer

    For a long time we have only USB device support in Zephyr OS, and unfortunately one with many drawbacks. Since a few months Johann is working on the new USB device support, and and recently also on the USB host support. Johann will make an overview of the overhauled USB device support in Zephyr OS, from the USB controller driver (UDC) API and tips on how to implement a new controller driver, to the USB device stack interface to classes or functions. In the second part the Johann will present the basic USB host support and USB host controller API, as deep as it is developed at the time of the presentation. The focus will be on testing the entire USB subsystem. Also the use of the USBIP protocol will be demonstrated. 

     

  • Deep Dive into Pin Control in Zephyr - Gerard Marull Paretas

    Pin control is a feature that is fundamental in most, if not all, systems. It allows configuring signal multiplexing, pin properties such as bias, drive mode, etc. Efforts have been made to standardize the way pin control works in Zephyr, leading to the new pinctrl API. We will talk about the pinctrl API in this presentation: its design principles, similarities with Linux, examples, etc.

     

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.  

 

Prerequisites

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 peripheral.zip

4. Flash the firmware package onto the board 

nrfutil dfu usb-serial -pkg peripheral.zip -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: 

text

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 sniffer_fw_pkg.zip

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 sniffer_fw_pkg.zip -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.