– I wrote an Ansible script to automate the provisioning and deployment of a complete development environment for NRF51 using the FruityMesh framework. Please note that the environment is hosted on a headless Ubuntu, so you need some command-line fu.The repo supports VirtualBox and Parallels running Ubuntu using Vagrant. I hope you find it be a useful way to quickly enable you to develop modules for BLE mesh experimentation or simply develop for the NRF51.

– I cloned the original and created this repo to exercise its mesh programming, specifically: * Timer functions * RSSI values * GPIO programming

The implementation demonstrates an RGB LED that changes colours when its paired NRFs change their relative signal strengths as their distance from it changes.

I hope you find these two artefacts useful, and as always, your comments are welcomed.

Introduction

There is not much documentation about the NRF51, and the tool-collection hunting and gathering process can be intimidating.I hope this blog entry will help those that want to use and program the Nordic NRF51 development board to test out BLE functionality.

The hardware

We are using the NRF51 development board, which was purchased from here.

Basic operations

Connecting to the board

Connection is done via conneting a standard Micro USB Cable to your host computer. Once power is supplied to board, it will run the current program automatically.

Communicating with the board

Flashing the device can be done using the JLinkExe program runing on the host computer. JLinkExe can be downloaded from here.

Resetting the board to manufacturer settings

From a terminal window, as the device is connected and turned on, run the following command line:

Programming the device

In order to program the device, you must first set up the following tools:

The Nordic SDK

The SDK can be downloaded from the Nordic website here. For our testing, we used nRF51_SDK_v9.0.0. The SDK contains a binary referred to as “SoftDevice” that supports BLE management of the chip. Please see below on how to load the SoftDevice to the board using JLink.

Compiler and Linker toolchain from GNU

The cross-compiler/linker tools that are needed to build executables for the board can be found here. We placed them under ‘/usr/local’. If you have multiple development environments, it may be easier to set an alias to run the right tools rather than modifying the path. For example:

Loading a binary to the device

An executable image is created in the form of “.HEX” files that has to be loaded to the board’s flash memory. To load it to the device, open a terminal window and run JLinkExe, this time using the loadfile command:

When you program BLE functionality, you will need to load the chip’s firmware in order to support your programs. This is packaged as an executable and is part of the SDK. In order to load the SoftDevice, simply use the loadfile command with the correct path, such as:

Select a different path if you want to change the version loaded (in this example, it’s S110).

Checkpoint

At this stage, you should have a connected board that has a version of the firmware loaded, and the toolchain downloaded, ready for development to begin!

BLE is hard, but blinking the board is easy

Using the toolchain let’s compile and load the demo blink program that comes with the SDK to make sure we have everything in place for future development.

Making Make make

Here you’ll edit the file named Makefile.posix to point to the correct toolchain for cross-development. The file is found at SDK_ROOT/components/toolchain/gcc/Makefile.posix, where SDK_ROOT being the location you installed the Nordik SDK files.Edit this file so it contains the path to where you installed the cross-compiler:

You should now see the board’s four LEDs should blink at a nice rhythm.

Debugging

Download the jlinkgdbserver debugger from here. When run, it will connect to the board via the serial cable, and wait for commands coming from the GNU debugger, which was included in the GCC download described previously.

This runs the debugger, loading debug symbols which will relay instructions to the JLink server that in turn will relay those to the board.

Summary

We made sure that the hardware and the development environment was set up correctly for future application development. In order to take advantage of the hardware’s capabilities, please refer to the documention of the board and firmware here, which contains essential links to the BLE functionality as well as a demo mesh project.

Acknowledgements

I’d like to thank Tim Kadom, my friend and colleague at ThoughtWorks, who sparked my interest by introducing me to BLE and mesh applications and was instrumental in helping me set up the environment and getting everything to work.

Introduction

There is not much documentation about the NRF51, and the tool-collection hunting and gathering process can be intimidating.I hope this blog entry will help those that want to use and program the Nordic NRF51 development board to test out BLE functionality.

The hardware

We are using the NRF51 development board, which was purchased from here.

Basic operations

Connecting to the board

Connection is done via conneting a standard Micro USB Cable to your host computer. Once power is supplied to board, it will run the current program automatically.

Communicating with the board

Flashing the device can be done using the JLinkExe program runing on the host computer. JLinkExe can be downloaded from here.

Resetting the board to manufacturer settings

From a terminal window, as the device is connected and turned on, run the following command line:

Programming the device

In order to program the device, you must first set up the following tools:

The Nordic SDK

The SDK can be downloaded from the Nordic website here. For our testing, we used nRF51_SDK_v9.0.0. The SDK contains a binary referred to as “SoftDevice” that supports BLE management of the chip. Please see below on how to load the SoftDevice to the board using JLink.

Compiler and Linker toolchain from GNU

The cross-compiler/linker tools that are needed to build executables for the board can be found here. We placed them under ‘/usr/local’. If you have multiple development environments, it may be easier to set an alias to run the right tools rather than modifying the path. For example:

Loading a binary to the device

An executable image is created in the form of “.HEX” files that has to be loaded to the board’s flash memory. To load it to the device, open a terminal window and run JLinkExe, this time using the loadfile command:

When you program BLE functionality, you will need to load the chip’s firmware in order to support your programs. This is packaged as an executable and is part of the SDK. In order to load the SoftDevice, simply use the loadfile command with the correct path, such as:

Select a different path if you want to change the version loaded (in this example, it’s S110).

Checkpoint

At this stage, you should have a connected board that has a version of the firmware loaded, and the toolchain downloaded, ready for development to begin!

BLE is hard, but blinking the board is easy

Using the toolchain let’s compile and load the demo blink program that comes with the SDK to make sure we have everything in place for future development.

Making Make make

Here you’ll edit the file named Makefile.posix to point to the correct toolchain for cross-development. The file is found at SDK_ROOT/components/toolchain/gcc/Makefile.posix, where SDK_ROOT being the location you installed the Nordik SDK files.Edit this file so it contains the path to where you installed the cross-compiler:

You should now see the board’s four LEDs should blink at a nice rhythm.

Debugging

Download the jlinkgdbserver debugger from here. When run, it will connect to the board via the serial cable, and wait for commands coming from the GNU debugger, which was included in the GCC download described previously.

Open another terminal window and run your image from the armgcc subdirectory so that JLinkExe will be able to load the debug symbols created when building the application:

prompt> gdb51

This runs the debugger, loading debug symbols which will relay instructions to the JLink server that in turn will relay those to the board.

Summary

We made sure that the hardware and the development environment was set up correctly for future application development. In order to take advantage of the hardware’s capabilities, please refer to the documention of the board and firmware here, which contains essential links to the BLE functionality as well as a demo mesh project.

Acknowledgements

I’d like to thank Tim Kadom, my friend and colleague at ThoughtWorks, who sparked my interest by introducing me to BLE and mesh applications and was instrumental in helping me set up the environment and getting everything to work.