Home

Awesome

n-able Arduino core

An Arduino Core for ARM based BLE boards supported by the NimBLE stack.

If you are interested in assisting the development of this project please submit issues and PR's. Or become a collaborator!

Features

Why?

I wanted to have a consistent BLE API on all of the devices I work with. NimBLE is the best choice for this as it is the most feature complete and fully open source library available for Arduino.

BLE

This Arduino Core does not contain any BLE functionality. It has been designed to support using the NimBLE-Arduino library for BLE operation. Note: Only the release version 1.4.0 and above of NimBLE-Arduino supports Arm devices.

Supported boards

nRF52840

nRF52833

nRF52832

nRF52810

nRF51

Installing

Platformio

  1. Install PlatformIO
  2. Create PlatformIO project and configure a platform option in platformio.ini file:
[env]
platform = https://github.com/h2zero/platform-n-able.git@^1.0.0
framework = arduino
lib_deps = h2zero/NimBLE-Arduino@^1.4.0
board = ...
...

Arduino Board Manager

  1. Download and install the Arduino IDE (At least v1.6.12)
  2. Start the Arduino IDE
  3. Go into Preferences
  4. Add https://h2zero.github.io/n-able-Arduino/package_n-able_boards_index.json as an "Additional Board Manager URL"
  5. Open the Boards Manager from the Tools -> Board menu and install "Arm BLE Boards"
  6. Select your board from the Tools -> Board menu

From git (for core development)

  1. Follow steps from Board Manager section above
  2. cd <SKETCHBOOK>, where <SKETCHBOOK> is your Arduino Sketch folder:
  1. Create a folder named hardware, if it does not exist, and change directories to it
  2. Clone this repo: git clone https://github.com/h2zero/n-able-Arduino.git
  3. Restart the Arduino IDE

Install NimBLE-Arduino

  1. Arduino Library manager: Go to sketch -> Include Library -> Manage Libraries, search for NimBLE and install version 1.4.0 or greater.
  2. Add #include "NimBLEDevice.h" at the beginning of your sketch.

Flashing your device

  1. Select your board from the Tools -> Board menu
  2. Select any options you want
  3. Select a programmer (J-Link, ST-Link V2, CMSIS-DAP, Black Magic Probe, adafruit-nrfutil or nrfutil) from the Tools -> "Programmer: " menu
  4. Connect your programmer to the device and click Upload

Uploading via Segger J-Link

  1. Make sure you have Segger J-Link installed on your system.
  2. (For Windows) add the JLink.exe path to your environment variables.
  3. Select J-Link as the firmware uploader in the tools menu.

Uploading via adafruit-nrfutil (for Adafruit bootloader devices only)

  1. Install adafruit-nrfutil if not already installed pip install adafruit-nrfutil
  2. Select adafruit-nrfutil as the firmware uploader in the tools menu.

Uploading via (Nordic) nrfutil (for Nordic bootloader devices only)

  1. Install nrfutil if not already installed pip install nrfutil
  2. Select nrfutil as the firmware uploader in the tools menu.

Configuration (optional)

You can change the configuration for many settings by creating a build_opt.h file in your sketch folder. In here you can set compile time definitions for settings that will be included directly on the command line. For example: '-DCONFIG_MAIN_TASK_STACK_SIZE=512' This will set the main task stack size to 512 words (2048 bytes).

Configuration option list

API

There are a few useful functions available to help with your project.

RTOS class functions

General system functions

Bootloader

Currently only some boards have Adafruit bootloaders available which are provided as options. You may choose to use the bootloader or none. The provided Adafruit bootloaders have no softdevice, if you currently are using the softdevice based Adafruit bootloader on your nRF52 board you will need to update it to the one provided by selecting it from the boards menu and clicking Burn Bootloader.

For boards without the Adafruit bootloader option clicking Burn Bootloader will simply erase the flash memory on the device. This is required if you have any bootloader flashed already.

Important notes

Credits

This core is based on Arduino-nRF5 by Sandeep Mistry, which is based on the Arduino SAMD Core. With some code from Adafruit_nRF52_Arduino

The following libraries are used: