## Starting with nRF51 BLE and Qt Creator

Recently I came across an interesting little ARM Cortex M0 microcontroller nrf51822, which has an integrated low energy Bluetooth (BLE)  and overall is a very capable to do other tasks besides BLE especially due to its immense FLASH memory  and RAM which is 256kb and 32kb accordingly (varies between models).  Immediately I thought of trying to make a simple smart-watch for various reasons like low energy mode, which I think was 0.1µA in sleep mode.  Only drawback compared to other ARM Cortex series microcontrollers is that it’s not really the fastest in the market, however a new one will be coming soon by first quarter of 2016, which will be more efficient, faster and overall more capable SOC. Luckily for us, their SDKs are pretty much identical, and once you learn and understand how nrf51 series SDK is structured and how to use it then switching to nrf52 shouldn’t be a problem. In any case I bought the development board BLE400 which is pictured above to play around; nonetheless I highly recommend buying the original nrf51-DK board just to support Nordic for developing an awesome micro.

This tutorial is intended for windows users, however setting up the environment in linux shouldn’t be much different and where I can I’ll try to warn about platform specific steps you need to take.

Also I’ll assume you have j-link programmer, which comes embedded on the original development board but does not come on the BLE400, if you don’t have one unfortunately you’ll need to hack a programmer from stm32 or just buy the edu version of j-link.

# Setting up compiling environment

Disclaimer, I don’t claim that the information provided here is my own; merely it’s a summary of what I’ve learned so far by playing with the micro as future reference for setting up another environment.

In this section we will try to set up the compiling environment for the nrf51 SOC. Here are the first things you’ll need to download and install/unpack:

1. GCC ARM Embedded
2. CoreUtils for Windows
3. Make for Windows
4. nRF51 SDK 10
5. nRF5x-Tools you’ll need to put softdevice and DFU. Also you can upload your application via this tool. I’ll explain what a softdevice is in another article.
7. Python 2.7.x, it will be necessary for GDB in Qt Creator

## GCC ARM Embedded and GNU Utils

Once you have finished installing the GCC ARM tools, make sure it is added to the PATH variable in your environment. To test whether it is, you can open CMD and just type:

arm-none-eabi-gcc  --version

This obviously should return you something similar as pictured below:

If it doesn’t and complains about not finding the command or something along those lines, then most likely ARM GCC is not in your PATH variable.  Normally, you’d need to add this line to your PATH variable:

C:/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q3/bin

One way to do it is to use command line even though I prefer to use GUI:

set PATH=%PATH%;C:/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q3/bin

While you are still in CMD, you can also check whether your “make” command can be executed

make -v

This should return you something like this:

If it doesn’t then again something is wrong with your PATH variable. Check if the following is in your PATH variable:

C:/Program Files (x86)/GnuWin32/bin

# nRF51 SDK 10

At this point you should have a working environment and be able to actually initiate compiling. Now unpack the SDK somewhere on your computer. First step is to test whether you are able to compile anything. If you followed previous step correctly you should be able to compile any example in the SDK.

## Preparing Makefile

Before we can actually compile SDK examples we must update the Makefile.windows or your corresponding systems file to reflect the location of GCC ARM directory

Navigate to “your sdk path/components/toolchain/gcc” and edit the file Makefile.windows
Technically you just have to update the version number of your GCC ARM, however on my Windows 10 machine it didn’t seem to work and it couldn’t resolve whether I have 64bit system or not, so I just got rid of the check and ended up with the following Makefile.windows:

PROGFILES := C:/Program Files (x86)

#### Jessica Roggers in Implementing pulse oximeter using MAX30100

Small portable size makes it easy to handle and carry. Helpful for athletes and pilots to obtain quick and precise oxygen saturation...

#### James J in Simple library for driving 20x4 LCD with 4bits

Very good writeup. I thought had been fighting my code for a week or two and confirmed what I was dooing was right. This overview is the best I have seen for doing the code. You may wish to add one thing though that I have found on another website. Urge people to check the contrast dial on...