This is an old revision of the document!
This lazy-guide is a HOWTO about how I made my modified, ANT+ capable Adafruit Feather nRF52840 Express being integrated into the Arduino desktop IDE.
On the page S340 SoftDevice & Adafruit nRF52840 Express Feather I have described how to make the nRF52840 Express Feather ANT radio-protocol capable. The trick was to add the S340 Softdevice to the bootloader. The original Arduino IDE support from Adafruit for this board based on the same bootloader.
The support of any board in Arduino IDE is based on a special Board Support Package (BSP). A BSP is a software package, such BSP package in Arduino jargon is also called as an “Arduino Core” package. The nRF52840 Feather is supported by the “Adafruit nRF52 by Adafruit” Core. This BSP is built on top of the Adafruit Bootloader, which we just modified to include the S340 SoftDevice (SD) instead/beyond of the S140 BLE-only softdevice (see section Prerequisites).
Whenever we want to upload an Arduino sketch, then the Arduino IDE invokes the appropriate board-specific compiler and linker via the BSP, then “uploads” it to the board via the appropriate upload-mechanism specified by the BSP.
In case of the nRF52840 Feather, this means bundling the freshly compiled sketch with the softdevice corresponding to the board, then uploading it to the board
For integrating S340 SD support into the Adafruit Core we have to achieve that
This HOWTO assumes that
Adafruit has described how to install their BSP either via the Arduino IDE board manager, or directly from GitHub. The latter method is said to be intended if “you wish to do any development against the core codebase [..] you can also optionally install the Adafruit nRF52 BSP manually using 'git'”. We will do exactly like that — except that we are going to install the alternative, S340 SD equipped bootloader that we have recently made! :)
In order to make this lazy self-contained, I have copied the text of the Adafruit Arduino Support Setup here, the copied text is denoted with with a gray quotation-bar
* Download and install the Arduino IDE (At least v1.8)
* 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 nRF52840 Feather Express' from the Tools → Board menu, which will update your system config to use the right compiler and settings for the nRF52:
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.
This step is only required on Linux, 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 adafruit-nrfutil version 0.5.3.post12
The initial part of these steps are identical to that of the manual installment of the Adafruit bootloader from GitHub. However, instead of installing the Adafruit one from GitHub we rather install the one modified by us when we have added the S340 SoftDevice for ANT radio-protocol support.
1. Install BSP via Board Manager as above to install compiler & tools.
2. Delete the core foldernrf52
installed by Board Manager in Adruino15, depending on your OS. It could be:macOS:~/Library/Arduino15/packages/adafruit/hardware/nrf52
<br/>
Linux:~/.arduino15/packages/adafruit/hardware/nrf52
<br/>
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:
macOS: ~/Documents/Arduino
Linux: ~/Arduino
Windows: ~/Documents/Arduino4. 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 git@github.com:adafruit/Adafruit_nRF52_Arduino.git
Instead of cloning the the original Adafruit bootloader, you should clone the modified one. If you feel really lazy, then you can clone my repo instead, if you want, but make sure that you use the right branch:
git clone -b adding-S340-to-nrf52840-Feather --single-branch https://github.com/orrmany/Adafruit_nRF52_Arduino.git
If you do use my repo, the do not forget that you will still need to download the S340 softdevice from thisisant.com and install it into the proper place, as redistribution of the said SoftDevice by individuals is not permited. You must sign the ANT license and respect its conditions. The way you can get the S340 is described at the Nordic Semiconductor page. About the “installation to the proper place” check out substep #2 of Section C of the page describing the bootloader modification
6. This should result in a final folder name like~/Documents/Arduino/hardware/Adafruit/Adafruit_nRF52_Arduino
.
7. Restart the Arduino IDE