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. adafruit-nrfutil Tool Installation

adafruit-nrfutil is a modified version of Nordic's nrfutil, which is used to flash boards using the built in serial bootloader. It is originally written for python2, but have been migrated to python3 and renamed to adafruit-nrfutil since BSP version 0.8.5. Follow the instruction depending on your installed version.

BSP version 0.8.5 and later

This step is only required on Linux. From version 0.8.5, pre-built binaries of adafruit-nrfutil for Windows and MacOS are already included in the BSP. That should work out of the box for most setups.

Install python3 if it is not installed in your system already

$ sudo apt-get install python3

Then run the following command to install the tool from PyPi

$ pip3 install --user adafruit-nrfutil

Add pip3 installation dir to your PATH if it is not added already. Make sure adafruit-nrfutil can be executed in terminal by running

$ adafruit-nrfutil version
nrfutil version 0.5.3.post9

BSP version up to 0.8.4

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!

Download Adafruit_nrfutil 0.5.2 and unzip it. Then open a terminal, go into the extracted folder and run the following command to installing requirements

cd Adafruit_nRF52_nrfutil-python2
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 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
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
This guide was first published on Mar 22, 2017. It was last updated on Sep 28, 2018. This page (Arduino BSP Setup) was last updated on Aug 22, 2018.