Development tools for Bluetooth Smart Applications – nRF5 SDK from Nordic
Principal Software Engineer - 05 October 2016 - 12min
Principal Software Engineer - 05 October 2016 - 12min
This is first of the series of blogs where we will be covering some of common development tools used for Bluetooth smart applications. In this part, I will be describing the popular Bluetooth LE SDK from Nordic.
A brief Introduction – Bluetooth LE
Bluetooth SIG announced the formal adoption of Bluetooth® Core Specification version 4.0 in 2011 which included the hallmark Bluetooth Smart (low energy) Feature.
From Wikipedia- “Bluetooth low energy (Bluetooth LE, BLE, marketed as Bluetooth Smart) is a wireless personal area network technologydesigned and marketed by the Bluetooth Special Interest Group aimed at novel applications in the healthcare, fitness, beacon, security, and home entertainment industries. Compared to Classic Bluetooth, Bluetooth Smart is intended to provide considerably reduced power consumption and cost while maintaining a similar communication range.”
Common Bluetooth LE Devices
Some of the common devices supporting Bluetooth smart (or BLE) feature in the market are Nordic nRF5 series, TI CC254x/CC264x, Cypress PSoC 4 BLE and CSR’s CSR101x system on chip (SoC). These devices offer support for Bluetooth 4.0 and later versions.
Currently, each of these devices supports different set of software development tools and environments.
|TI CC254x/CC264x||IAR Embedded Workbench, Code Composer Studio, Bluetooth Developer Studio|
|Nordic nRF5 series||nRF5 v11 SDK + GNU Tools, IAR Embedded, ARM mbed, Keil MDK-ARM, Bluetooth Developer Studio|
|Cypress PSoC 4 BLE||PSoC Creator, IAR Embedded|
|CSR CSR101x||µEnergy Software Development Kit|
In this article, I will describe some of these tools/IDEs used for programming and flashing one of the BLE devices BLE Nano based on Nordic chipset for windows platform.
nRF51822 SoC based BLE Nano
I used the Nordic’s popular ultra-low power nrf51822 SoC based RedBearLab BLE Nano kit for setting up beacon based application. Currently, there are a few options for developing applications for BLE Nano.
I decided to start with nRF5 v11 SDK which was most stable and had no dependency of any third party tool. It integrates the nRF51/nRF52 series 2.4GHz transceiver, a 32 bits ARM® Corte-M0 CPU, Flash memory, analog and digital I/O, supporting both Bluetooth Low Energy, ANT or proprietary 2.4 Ghz protocols.
nRF5 v11 SDK
The nRF5 v11 SDK provides a rich development environment for the nRF51/nRF52 Series BLE devices. The SDK includes broad selection of libraries, drivers, examples for peripherals, SoftDevices and profiles. The SDK comes with support for various IDE/Compilers such as Keil μVision™ IDE, GCC make files and IAR support.
Before a device can be programmed with a user application, it must be flashed with the correct SoftDevice. These are pre-compiled, pre-linked hex files that contain all low-level APIs over Bluetooth and other capabilities of the chip. They are available with the SDK or directly downloadable from Nordic website. We will be using S130 for our application as they are compatible with nRF51822 (BLE Nano) and support both peripheral and central roles.
Compiling and debugging
nRF51 SDK contains source code and libraries for application examples (like GATT profiles), Bluetooth smart and ANT profiles, bootloaders, wired and OTA firmware upgrades.
There are several Bluetooth profiles such as proximity and heart rate in form of pre-compiled hex file that can directly be flashed into device.
I picked up the ble_app_proximity sample project as my starting point and added application logic required for my beacon application. After the code is successfully compiled using GNU command line tools, a hex file is generated in <>/_build folder.
For Debugging, we will need SEGGER J-Link hardware additionally and connect it with BLE Nano. After that, we need to recompile the appropriate target and flash the updated hex file through J-link.
The nRF51822 development can also be done using eclipse IDE and GNU ARM Eclipse plug-in. Please refer to Development with GCC and Eclipse and Using eclipse and GNU gcc to program and debug BLE Nano for further instructions.
Flashing the project to device
This hex file is flashed into the device using the MK20 board provided with the BLE Nano kit. When MK20 board with BLE Nano on top, is plugged into a usb port, a new drive named MBED appears under my computer. We just need to drag the hex file into that drive and the bootloader will load the new code. Please note that flashing the device may vary from device to device and the same can be referred in the device manual.
Tip: In case you want to try different SoftDevices with same user application, there is a command line utility mergehex (for windows platform) that is used to combine SoftDevice and Application hex files. This combined hex can, then, be deployed to have the same effect.
If you have a regular nRF5 development kit, you can use the makefie targetsflash_softdevice and flash to flash the application directly to your device. Makefile internally uses an ARM provided tool nrfjprog for flashing.
You can refer nRF5 getting started, Tutorials – Nordic Developer Zone, Getting Started – BLE Nano and ANCS example on BLE Nano link to setup the device, development and toolchain, use BLE APIs and run the examples provided.
Some of the advantages using the nRF5 v11 SDK were
Hope you found this blog useful. Write to the author at email@example.com for any queries or suggestions.