Adafruit Feather Express, Zephyr and some Black Magic

Asen Lekov
3 min readAug 17, 2020

I was playing around with some Nordic boards. One of them is this one — Adafruit Feather Express with nRF52840 BLE SoC. Initially, I used Arduino IDE to write some basic test apps but for a project of mine with friends, we decided to set up nRF SDK because we were designing a custom board for a project with nRF52840.

First steps

My friends from NextLab have solid experience with Nordic and of course other chips. They helped me to set up a working environment using nRF5 SDK version 16 and Eclipse as an IDE. Read here how to make it work:

Cool, but I decided to get a little further. Searching for some details around the new Nordic Connect SDK on the Nordic DevZone I found something interesting mentioning PlatformIO. Going further I found that this is the only straightforward way to set up a new project for CLion using Platformio’s plugin. CLion does not currently support the build system west which is used by Zephyr and the nRF Connect SDK.

Giving it a try

Following the Platformio official guide I could easily set up a project for my Adafruit Feather Express.

The options

You have several options when creating a project for your Adafruit. You can use the “Adafruit Feather nRF52840 Express” board from the wizard but here is the gotcha — it will use the Arduino framework and also you must use one of the following protocols for upload:

jlink, nrfjprog, nrfutil, stlink

Another option is to use “Nordic nRF52840-DK (Adafruit BSP)”. Again limited for my purpose frameworks (just Arduino) and few debugger options:

jlink, nrfjprog, stlink

The last chance is to use “Nordic nRF52840-DK” — plenty of upload protocols and all frameworks supported. I want to use my Black Magic Probe debugger. Let’s go!

Black magic blinky

Make sure your Black Magic is up-to-date with the latest firmware. My previous article addresses this.

After the project was created I copied the blinky demo from GitHub. Then build the project. To use the Black Magic Probe you must update the platformio.ini configuration:

[env:nrf52840_dk]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
debug_tool = blackmagic
debug_port = /dev/cu.usbmodem79A67BCB1
upload_protocol = blackmagic
upload_port = /dev/cu.usbmodem79A67BCB1

Select PlatformIO Upload or PlatformIO Debug target and hit run!

Everything should be fine except that you won’t see any blinking LEDs… Ha-ha-ha…

Device Trees

After spending some time debugging and testing why the hell the LED is not working, at last, I figured it out — My Adafruit and the DK have different device trees, which means different pinouts mapping, different LEDs mapping, etc. Remember that we used the DK as a template to have a Zephyr and Black Magic support!

Checking this one…

And the DK and you will find the differences:

Okay… let’s try just changing the defines to match our board…

#define LED_PORT    "GPIO_1"
#define LED 15

Build, run, and voila!

Extras

Currently, the setup requires two USB cables to power the probe and the Adafruit separately. You can get rid of the Adafruit power and supply it from the probe directly. Slight modifications are needed in platformio.ini. I modified the default debug commands and added:

monitor tpwr enable

--

--

Asen Lekov

Experienced native mobile and web developer. Interested in management and education with a solid experience behind.