Arduino BSP Setup

You can install the Adafruit Bluefruit nRF52 BSP in two steps:

nRF52 support requires at least Arduino IDE version 1.6.12! Please make sure you have an up to date version before proceeding with this guide!
Please consult the FAQ section at the bottom of this page if you run into any problems installing or using this BSP!

1. BSP Installation

Recommended: Installing the BSP via the Board Manager

  • Download and install the Arduino IDE (At least v1.6.12)
  • Start the Arduino IDE
  • Go into Preferences
  • Add https://www.adafruit.com/package_adafruit_index.json as an 'Additional Board Manager URL' (see image below)
  • Restart the Arduino IDE
  • Open the Boards Manager option from the Tools -> Board menu and install 'Adafruit nRF52 by Adafruit' (see image below)

It will take up to a few minutes to finish installing the cross-compiling toolchain and tools associated with this BSP.

The delay during the installation stage shown in the image below is normal, please be patient and let the installation terminate normally:

  • Once the BSP is installed, select 'Adafruit Bluefruit nRF52 Feather' from the Tools -> Board menu, which will update your system config to use the right compiler and settings for the nRF52:

2. Third Party Tool Installation

The following third party tools must also be installed on your system to allow you to work with the Bluefruit nRF52 Feather:

This step is only required on OS X and Linux. If you are using Windows, a pre-built 32-bit binary of nrfutil is already included in the BSP that should work out of the box for most setups.
You will need to have both Python and pip available on your system to use the tools below!

Adafruit's nrfutil (OS X and Linux Only)

This is a Adafruit modified version of Nordic's nrfutil, which is used to flash boards using the built in serial bootloader.

To install this tool, download the tool in respect to your BSP version as follows:

BSP version from 0.8.5

  • Download the latest Adafruit_nrfutil 0.5.3 then unzip it, this version requires python3 to install
  • or run git clone https://github.com/adafruit/Adafruit_nRF52_nrfutil.git

BSP version up to 0.8.4

  • These versions use the older Adafruit_nrfutil 0.5.2 then unzip it, this require python2 to install
  • or run git clone https://github.com/adafruit/Adafruit_nRF52_nrfutil.git --branch python2

Open a terminal, go into the extracted (or cloned) folder and run the following command to installing requirements

sudo pip install tornado nose
sudo pip install -r requirements.txt
If you get a 'sudo: pip: command not found' error running 'sudo pip install', you can install pip via 'sudo easy_install pip'

If you don't have git install  you'll need to install it with

  • brew install git (macOS)
  • sudo apt-get install git-core (linux debian)

If you get a complaint about six

Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall

then add --ignore-installed six to the command

sudo pip install -r requirements.txt --ignore-installed six

After all requirements is install, run this command to install nrfutil

sudo python setup.py install

Check your install with version sub command

nrfutil version

it should reply: nrfutil version 0.5.2d

Don't install nrfutil from the pip package (ex. `sudo pip install nrfutil`). The latest nrfutil does not support DFU via Serial, and you should install the local copy of 0.5.2 included with the BSP via the `python setup.py install` command above.

3. Advanced Option: Manually Install the BSP via 'git'

If you wish to do any development against the core codebase (generate pull requests, etc.), you can also optionally install the Adafruit nRF52 BSP manually using 'git', as decribed below:

Adafruit nRF52 BSP via git (for core development and PRs only)

  1. Install BSP via Board Manager as above to install compiler & tools.
  2. Delete the core folder nrf52 installed by Board Manager in Adruino15, depending on your OS. It could be
    OS X~/Library/Arduino15/packages/adafruit/hardware/nrf52
    Linux~/.arduino15/packages/adafruit/hardware/nrf52
    Windows%APPDATA%\Local\Arduino15\packages\adafruit\hardware\nrf52
  3. Go to the sketchbook folder on your command line, which should be one of the following:
    OS X: ~/Documents/Arduino
    Linux: ~/Arduino
    Windows: ~/Documents/Arduino
  4. Create a folder named hardware/Adafruit, if it does not exist, and change directories into it.
  5. Clone the Adafruit_nRF52_Arduino repo in the folder described in step 2:
    git clone [email protected]:adafruit/Adafruit_nRF52_Arduino.git
  6. This should result in a final folder name like '~/Documents/Arduino/hardware/Adafruit/Adafruit_nRF52_Arduino' (OS X).

  7. Restart the Arduino IDE

 

BSP FAQs

The following FAQs may be useful if you run into any problems:

Windows Related

If you are using BSP 0.6.0 or greater, there are no known issues with the BSP installation process on Windows. Please update to the latest version if you currently have an earlier release.

OS X Related

I can compile and link sketches on OS X, but nrfutil gives me the following error: 'AttributeError: 'int' object has no attribute 'value''?

Depending on your system setup and Python version, you may need to make a manual adjustment to a file in nrfutil, which is used when compiling and flashing files from the Arduino IDE.

Open the following file (please note that the BSP version number in the path may be different!): ~/Library/Arduino15/packages/adafruit/hardware/nrf52/0.5.1/tools/nrfutil-0.5.2/nordicsemi/dfu/init_packet.py ... and make the following changes:

@@ -79,7 +79,7 @@
-        for key in sorted(self.init_packet_fields.keys(), key=lambda x: x.value):
+        for key in sorted(self.init_packet_fields.keys(), key=lambda x: x):
@@ -94,7 +94,8 @@
-        for key in sorted(self.init_packet_fields.keys(), key=lambda x: x.value):
+        for key in sorted(self.init_packet_fields.keys(), key=lambda x: x):

When trying to compile code in Arduino IDE I get "fork/exec /usr/local/bin/nrfutil: no such file or directory Error compiling for board Adafruit Bluefruit nRF52 Feather."

Try running this command in a Terminal window to put nrfutil in a path that Arduino can find:

sudo sh -c "ln -s `which nrfutil` /usr/local/bin/nrfutil"

Linux Related

On Linux I'm getting 'arm-none-eabi-g++: no such file or directory', even though 'arm-none-eabi-g++' exists in the path specified. What should I do?

This is probably caused by a conflict between 32-bit and 64-bit versions of the compiler, libc and the IDE. The compiler uses 32-bit binaries, so you also need to have a 32-bit version of libc installed on your system (details). Try running the following commands from the command line to resolve this:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386
Last updated on Aug 04, 2018 Published on Mar 22, 2017