User Tools

Site Tools


s340_softdevice_adafruit_nrf52840_feather_express

This is an old revision of the document!


S340 SoftDevice & Adafruit nRF52840 Express Feather

This lazy-guide is a short summary about how I made my Adafruit Feather nRF52840 Express work with ANT+.

The Feather is an Arduino compatible board using the nRF52840 SoC from Nordic Semiconductor (NordicSemi).

Introduction

ANT (Adaptive Network Topology) is a wireless communication network standard intended for sensor networks. Originally developed by DynaStream, it currently belongs to Garmin. It operates in the ISM spectrum and most of its specs available publicly. Certain IPR-s remains controlled by Garmin, but for non-commerical use it can be used without a license fee.

ANT+ is a interoperability standard on top of the ANT transport standard in order to create an “ultra low-power wireless” ecosystem for fitness and medical applications. Notably, Garmin runners' and bikers' watches and bike-computers uses this standard to communicate with various measurement sensors.

The nRF52840 SoC is part of the nRF52 series of chips from NordicSemi. It is multi-protocol capable and a number of Arduino compatible boards sports this chipset. The most notable ones:

For legal (and probably other reasons) neither of these boards come with the ANT+ protocol stack pre-installed, albeit they are fully capable of running that stack. This guide is a summary of how I made my Adafruit nRF52840 Feather ANT+ capable while I kept its original functionality, i.e., being Arduino compatible and supporting Adafruit's Bluefruit Bluetooth library.

The adaptation removes the Bluetooth only S140 SoftDevice from the firmware and replaces it with the S340 combined SoftDevice running BLE5 and ANT+ concurrently.

Note: The CircuitPython capability will be lost, since the stock CircuitPython interpreter for this Feather is provided as a binary UF2 firmware update is bound to the S140 Bluetooth-only softdevice.

BEWARE: trying to install the CircuitPython UF2 package to a S340-adapted Feather will brick your Feather and you will need to use a SWD programmer device to make your Feather usable again!

Credits

A number of internet resources helped me. The biggest help came as form of a personal mail from “Ryan”, whom I got acquainted with by Curtis Malainey. It was “Ryan”, who first managed the S340 SoftDevice to work with his Feather and he kindly shared his steps with me. This guide is based primarily on his work.

Prequisites

Must to have

Most likely you will need to have

  • An SWD programmer (Segger J-link), just in case if you need to “unbrick” your feather after a mistake.

Note: the nRF52840-DK from NordicSemi contains an On-Board Segger programmer (Segger-OB), which is free to use for Nordic chipsets. The Segger OB on the NordicSemi DevKit also has an SWD connector for external boards, so it can be used with the Feather, as well. Otherwise the Segger EDU can be a not-so-expensive alternative

Good to have

Adapting the bootloader

Warm-up: Rebuild the Adafruit bootloader

1. Clone the Adafruit bootloader from https://github.com/adafruit/Adafruit_nRF52_Bootloader. It contains two submodules, hence you need to clone it recursively. I used to the GitHub Desktop, which does recursive cloning automagically

git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
cd Adafruit_nRF52_Bootloader
git submodule update --init --recursive

Follow its readme: https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md

  1. install the ARM-GCC toolchain, plus the GNU make, as needed. See above
  2. install nRF5x command line tools, as needed. See above
  3. install adafruit-nrfutil, a modified version of Nordic nrfutil, which required to perform DFU. Install python3 if it is not installed already and run this command to install adafruit-nrfutil from PyPi:
$ pip3 install --user adafruit-nrfutil

2. Make sure that you can succesfully build and flash it into your board.

Follow the instructions at https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md. Change the serial to your actual serial device. For me, under Windows10 it was COM5. Under Linux it could be, for example, /dev/ttyACM0

$ make BOARD=feather_nrf52840_express all combinehex
$ make BOARD=feather_nrf52840_express SERIAL=COM5 dfu-flash

If you run into any trouble, then DO NOT PROCEED until you can successfully rebuild the original bootloader and flash it into your device!! (If you can't build and flash the original version, then it makes no sense to try to hack it.

Get the ANT SoftDevice

Download S340 SoftDevice from

Modify the Adafruit bootloader

Adapt the Makefile

@@ -104,6 +104,11 @@ else ifeq ($(MCU_SUB_VARIANT),nrf52840)
else
  $(error Sub Variant $(MCU_SUB_VARIANT) is unknown)
endif
ifdef USE_S340 
#if S340 then adjust SD_NAME and MCU
  SD_NAME = s340
  MCU_FLAGS = -DNRF52840_XXAA -DS340
endif
 
#******************************************************************************
# SOURCE FILES
s340_softdevice_adafruit_nrf52840_feather_express.1581106877.txt.gz · Last modified: 2020/02/07 21:21 by orrmany