nRF52 — Project Setup with Segger Embedded System

Image for post

What is nRF52?

nRF52 is a series of ARM Cortex M4 based microcontrollers with short range wireless capabilities. They support a wide range of protocols like ANT, Thread, 802.15.4, Zigbee, the widely used Bluetooth Low Energy (BLE) and BLE mesh.

The nRF52 is widely used for BLE projects as it has an a well documented SDK with a large number of libraries and drivers. It is one of the go to MCUs for anything BLE related and has been widely adopted.

The nRF5 SDK supports a wide range of workflows. You can use it with a text editor to edit and a terminal to build the project. Or you can use an Integrated Development Environment (IDE) like ARM Keil, Segger Embedded Studio (SES), Eclipse etc. Nordic and Segger have a partnership where they provide SES for free to anyone using a Nordic product.

This post will show you how to setup SES and run your first program on the nRF52 DK.

Hardware requirements:

  • 1 nRF52 Development Kit
  • 1 Micro USB to USB Type A cable

IDE and SDK Setup:

  • Download Segger Embedded studio for ARM for your respective OS
  • Run the SES installer
  • Once the installation is done, start SES.
  • A window will open up saying that “Nor commercial-use license detected”.
  • Click on “Obtain a license”
  • Segger’s website should open up on your browser. Scroll down to the section titled “Free commercial use license”
  • This section has a link from which you can request a license which can only be used with Nordic’s products.
  • Enter your details in this page. To get your computer’s MAC address:
  • You should receive the license in the email ID you have submitted in the license request form.
  • In SES, navigate to “Tools > License Manager > Activate Embedded Studio”.
  • Copy the license key from the mail, paste it and then click on “Install License”.
  • Download the nRF5 SDK 17.0.2
  • Extract the SDK to a location of your choosing

The first project:

The blinky project is the “Hello world” project for embedded engineers. This objective of this project is to check if the hardware and the installed software are working properly. This program will toggle the state of all the 4 LEDs on the nRF52 DK.

Navigate to where you have extracted the nRF5 SDK. Navigate to “examples/peripheral/blinky/pca10040/s132/ses/”. In this folder, you will notice a file called “blinky_pca10040_s132.emproject”. Double click this file and SES should load the project.

blinky -> Name of the project

pca10040 -> Codename for the nRF52 DK

s132 -> Softdevice version

Softdevice is a library provided by Nordic which handles all of the BLE/any wireless protocol related operations.

Image for post

To build the project, you ca use the shortcut “F7” or click on “Build > Build blinky_pca10040_s132”.

The status of the build can be seen in the output section which is situated in bottom center of the window. A successful build will look like this:

Image for post

If there are any errors, it will be listed in the output section.

Image for post

Connect the nRF52 DK to your computer using a micro USB to USB Type A cable. The program can be downloaded by going to “Target > Download blinky_pca10040_s132”.

You will observe that the LEDs from LED1 to LED4 will first turn on and then will turn off in the same order continuously