This lab will go over all the steps needed to download, install , configure, license and test the SEGGER Embedded studio for Nordic nRF5x devices and development boards. SEGGER Embedded Studio(SES) is a full-fledged powerful C/C++ integrated development environment for ARM and Cortex, microcontrollers and microprocessors. It comes with both GCC and Clang/LLVM toolchains (C/C++ cross compilers, linkers , assemblers, image utilities,etc.. ) and C/C++ standard libraries that have been specifically tailored for embedded systems. SES is cross-platform, it runs on Windows, Mac OS and Linux. The main two advantages to choose SES over other standard IDE such as Keil , and IAR is that SEGGER and Nordic Semiconductor have signed an agreement in late 2017 that entitles developers to use Segger Embedded Studio with Nordic nRF5x chips for both commercial and non-commercial uses free of charge. The second reason is that all Nordic nRF5 SDK examples have SES projects support , which significantly simplifies the process of project setup, prototyping and testing. To see the full comparison among all methods available to program the nRFx devices check the article “Which IDE to choose ?” in LabA-4 .
Setting up the tools
1.Download Nordic nRF5 SDK : Follow the steps explained in in LabA-4 to select the right SDK version for you device or development kit. In this Lab we are assuming the nRF52840-DK development board (Board ID: PCA10056) is being used.
b.Create a folder called nordic_semi on your local disk ( it’s preferable to place it as close as possible to the root directory and avoid paths which contain white white spaces), and then extract the .zip-archive file.
With this the nRF5 SDK has been downloaded and ready to be used by the Seeger Embedded Studio.
2.Download Segger Embedded Studio(SES): Go to https://www.segger.com/ , and from the Downloads menu choose Embedded Studio as shown in the screenshot below.
In the Downloads page of the Embedded Studio, select Embedded Studio for ARM, then select the download that fits your operating system. SES is supported on Windows , macOS and Linux . ( The example here assumes a Windows machine)
3.Install Segger Embedded Studio(SES): Once the download is complete, run the installer file as an administrator and then follow the basic installation steps as shown in the screenshots below.
Select your preferred installation path or leave default options as is
Make sure to install the J-Link device driver to be able to program the development boards.
Installation will start. It will take few minutes to finish. Once the installation is done, the following window will pop up. Make sure that the option Start SEGGER Embedded Studio for ARM x.xxx is checked and click Next.
Segger Embedded Studio will open with an example hello world program. Leave the program open as we will in the next step request the free of charge license for Nordic Semiconductor development boards and devices.
4.License Segger Embedded Studio(SES) for Nordic devices: SEGGER and Nordic Semiconductor have signed an agreement in late 2017 that entitles developers to use Segger Embedded Studio with Nordic nRF5x chips for both commercial and non-commercial uses free of charge.
a. In SES, right click on the Solution ‘Hello’ and select Build.
b. A message indicating that no commercial license is found will pop up. Click on Activate Your Free License as shown in the screenshot below.
c. The request license window will show up next. You need to enter your first, last name, company name and a valid email address as the license will be sent to you by email as text(Activation Key). The request license window will automatically link the license with the MAC address of your machine.
d. The activation confirmation message pops up indicating that the activation key has been sent to the specified email .
e.You should now check your email for your Activation Key, which is a string of text that you need to copy and paste in the activation box and then click Install License.
The build process will start and now you have a licensed SES for Nordic Semiconductor devices.
5.Install nRF CPU Support Package: The nRF CPU Support Packages include all supporting files needed to create a complete new project from scratch. It include startup files, memory maps, CPU initialization, etc…. To install the Support Package for the Nordic Semiconductor devices in SES , select Tools > Package Manager…
The Check for update of Package Manager will show up, click Yes to download the latest packages .
After the download finishes, type Nordic in the search bar of the Package Manager.
Right click on nRF CPU Support Package , select Install Selected Packages and then click Next.
Click Next in the Summary window. Then Click Finish when the installation is complete.
6.Setup the CMSIS Configuration Wizard in SES : The the CMSIS Configuration Wizard is a small utility developed in Java which simplifies the process of enabling and disabling modules in the SDK configuration file sdk_config.h. In order to use this utility with SES, you need to register it as an external tool . To do that, open SES, click on File> Open Studio Folder> External Tools Configuration .
The tools.xml file file will open up in the editor. Copy the code below and paste it in the tools.xml exactly as shown in the screenshot below.
<item name=“Tool.CMSIS_Config_Wizard” wait=“no”><menu>&CMSIS Configuration Wizard</menu><text>CMSIS Configuration Wizard</text><tip>Open a configuration file in CMSIS Configuration Wizard</tip><key>Ctrl+Y</key><match>*config*.h</match><message>CMSIS Config</message><commands>java -jar "$(CMSIS_CONFIG_TOOL)" "$(InputPath)"</commands></item>
Note: You need Java to be installed on your computer for this utility to work.
With this the SES is setup and ready to be used to develop firmware for the nRF5x Nordic Semiconductor devices and development boards. In the next paragraph we will start our first program in SES. The paragraph after that shows the steps needed to run the examples offered in the next labs.
Your first program
To test that all the steps we did previously are correct and that the Segger IDE is ready for action, we will run a very simple example “Blinky Example” from the nRF5 SDK. The Blinky example toggles the boards LED using the Board Support Package(BSP) which we will cover in depth in the later labs.
The Blinky Example shows how to configure the GPIO pins as outputs using the BSP library. These outputs can then be used to drive LEDs, as in this example.
When the application starts, some GPIO pins are configured as outputs to drive the LEDs. The application then loops while toggling the state of one of the LEDs every 500 milliseconds.
1.Browse to the example directory: Using your files browser, head to <nRF5 SDK Installation Path>\nordic_semi\nRF5_SDK_15.0.0_a53641a\nRF5_SDK_15.0.0_a53641a\examples\peripheral\blinky
2.Select the folder which matches your board ID: In here, we are assuming that the development is done for the RF52840 DK development board which has the board ID (PCA10056) . Therefore , we will select the pca10056 folder. If you are using a different development board , you need to select a different folder . Refer to LabA-3 for more information on the available boards in the nRF52 series and their board ID number.
3.Select whether to run with/without a protocol stack or advanced feature(s): You will notice that inside almost all board folder examples there are two and sometimes more folders ; one is usually called blank which mean without a supporting interface protocol stack or advanced features . The other folder(s) are usually the name of the supporting protocol stack (s130 softdevice, etc.. )or advanced feature . Since we are not using any protocol stack in this simple example , select blank
4.Select ses folder: Since we are using the Segger Embedded Studio(SES) , select the ses folder to open the SES project file.
5.Open the ses project file : Double clink on the blinky_pca10056.emProject file to open the example in SES.
6.Compile and Build the project : Click Build -> Build blinky_pca10056 or press F7
The build process will internally invoke the compiler ,assembler and linker and produces the executable blinky_pca10056.hex which will be flashed on the board. It will take few seconds to finish.
7.Connect the board to the development machine : Connect a Micro-USB cable to your development board (Port J2) and the other end of the USB cable to your laptop/workstation , then switch on your development board (SW8)
8.Download executable on the board : To download the program executable on the board, select Target-> Download blinky_pca10056 . The program will run automatically on the board.
You should notice that the board LEDs (LED1-LED4) are toggling now every 500 milliseconds.
9.Modify the code (Optional ): Modify the code and increase the toggling delay from 500 to 2500 milliseconds, then save (Ctrl+S), build and download as done in the previous steps. You should now observe the LEDs are toggling at a much lower rate.
Running Embedded Centric labs and tutorials
In the next labs we will start diving into more hand-on examples and labs. The source code and the SES project files for these labs are available on a GitHub repository . To be able to run any of these labs, you need to do the steps below
1.Create a directory named embeddedcentric: This directory will hold the projects files of the next labs.
2.Clone the labs repository from GitHub: Use your favorite git tool to do that , or simply go to https://github.com/ama142/Nordic-BLE-Training and click on Clone or download -> Download ZIP .
3.Extract the repository ZIP file: Once the download is complete,extract the content of the compressed file.
4.Copy the content into the embeddedcentric folder: Copy all files and directories inside the Nordic-BLE-Training-master folder and paste them in the embeddedcentric directory created recently . Do exactly as shown in the screenshot below , creating or removing directories might cause compilation errors as the search paths for the SDK libraries, drivers and include files might be modified inadvertently.
5.Open the ses project file for the desired lab : Double clink on the SES project file that you want to run( Example LabA6.1)
6.Compile and Build the project : Click Build -> Build name of the lab or press F7
7.Connect the board to the development machine: Connect the USB cable to your development board (Port J2) and the other end of the USB cable to your laptop/workstation , then switch on your development board (SW8). The labs are built for the nRF52840-DK but can be easily modified to tailor any other nRF5x-based development boards or devices.
8.Download executable on the board : To download the program executable on the board, select Target-> name of the lab . The program will run automatically on the board.