Integrated Development Environment is a cross-platform (IDE), so you can run it on different operating systems. For use with Nordic Semiconductor devices, you can get a free license that has no limitations. There are two Getting Started Guides that show how to work with different IDEs: •...
Minimum requirements Ensure that you have all the required hardware and that your computer fulfills the software requirements. Hardware requirements • One of the following nRF5 Series development kits: • nRF52840 • nRF52 • nRF51 • Micro-USB 2.0 cable • Personal computer (PC) or Mac ®...
Related documentation This guide is a starting point and gives essential information for getting started with software development on nRF5 Series devices. For more detailed information, check the documentation of the separate components and tools. Development Kit User Guides nRF52840 Development Kit nRF52 Development Kit nRF51 Development Kit Dongle User Guides...
Development kits, boards, and chips Each nRF5 Series contains a board, which in turn contains a chip. Some of Nordic Semiconductor's tools target the chip, while others target the development board or the development kit. Therefore, you must be aware of the relation between the different components.
SoftDevices SoftDevice is a wireless protocol stack that complements an nRF5 Series SoC. Nordic Semiconductor provides them as qualified, precompiled binary files. While it is possible to build applications without ™ using a SoftDevice, all nRF5 SDK example applications that use Bluetooth Low Energy or ANT require a SoftDevice.
Running a first test Before you start developing, program and run a simple application on your development board to ensure that the board functions as expected and the communication between your computer and your development board works. Before you begin, download the latest compatible version of the nRF5 SDK.
See the following sections for installation instructions. 7.1 Nordic tools and downloads This overview lists all available Nordic Semiconductor tools and supported IDEs. Not all of these tools are required. To help you pick the and tools you want to use, see the following sections for common setup scenarios.
Page 11
Setting up your toolchain Tool Description Download Documentation Protocol Application Windows/Linux nRF5 SDK BLE/ANT (Software examples, source nRF5 SDK for Mesh Bluetooth Development files, SoftDevices Mesh Kit) nRF5 SDK for Thread and Zigbee Thread and Zigbee nRF5x Collection of nRF5x Command Line BLE/ANT nRF5x Tools Windows32 Command...
Page 12
Connect for Peer device emulator Android v4.3 or later Mobile app for smartphones IOS v8 or later Nordic nRF Toolbox App that contains all Android v4.3 or later the Nordic apps IOS v8 or later Windows Phone v8.1 or later...
Note: Compilers tend to run into problems with long path names. Therefore, place the folder as close to the root level of your file system as possible (for example, at C:/Nordic/SDK). Also, avoid using spaces in the file path and folder name.
Go to the Windows Advanced system settings and click Environment Variables. b) Select the Path variable and click Edit. c) Add the following text at the end of the variable value: ;C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin Make sure that you add a semicolon (;) between entries in the PATH values: path1;path2 d) Click OK twice.
Programming an application After setting up the required toolchain, you are ready to compile your application and program (or "flash") it to your development board. Starting with v14.1.0, the nRF5 SDK supplies SEGGER Embedded Studio projects. If you are using an older version of the nRF5 SDK (for example, nRF5 SDK v12.3.0, which supports nRF51 Series devices), you must import and convert the Keil µVision projects.
Programming an application • For nRF51 devices: nrfjprog --family nRF51 --eraseall • For nRF52 devices: nrfjprog --family nRF52 --eraseall 8.2 Importing Keil projects If you are using a version of the SDK that supports SES, thus nRF5 SDK v14.1.0 or later, you should open one of the supplied projects and skip this step.
Page 17
Programming an application Target for flashing the SoftDevice, delete this Target in SES: 4. If the project that you imported contains a a) Select Project > Build Configurations. Target b) Under Public Configurations, select the (for example, flash_s130_nrf51_2.0.1_softdevice). c) Click the - symbol to remove the Target. The build configuration should now look similar to this: 5.
Page 18
Programming an application The Project Explorer should now look similar to this: 6. Include the device header files in the project: a) Right-click your project and select Edit Options. b) Select Preprocessor. c) Add the following path to the User Include Directories field: ../../../../../../ components/device The user include directories should now look similar to this: 1159720_163 v1.1...
Page 19
Programming an application 7. If your project uses modules that require section variables (for example, the Peer Manager, Flash Data Storage, or Flash Storage), define where in the flash information from these modules should be stored. a) Download the flash_placement.xml and place it in your project directory. Files are provided for the following versions of the nRF5 SDK: •...
Programming an application c) Confirm that you want to use the section placement for the current build configuration. 8.3 Compiling the application You can compile the application from a project provided by the nRF5 SDK v14.2.0 or later, or from the project that you created based on an older SDK example.
Programming an application 8.4 Configuring placement of the SoftDevice If your application uses Bluetooth or ANT, you must program a SoftDevice in addition to the application. Note: If your application does not use a SoftDevice, you can skip this step. If you are using a project from nRF5 SDK v14.2.0 or later, the placement of the SoftDevice is already configured correctly and you can skip this step.
Page 22
Programming an application 4. Select Build > Rebuild project_target to rebuild the project. Alternatively, press ALT + F7. The output should now look similar to this, with space reserved for the SoftDevice: 5. Right-click your project and select Edit Options. 6.
Page 23
Programming an application 8. In the Debug section of the project options, select Loader. 9. Add the absolute path to the SoftDevice to the Additional Load File[0] field, for example, ../../../../../../components/softdevice/s130/hex/ s130_nrf51_2.0.1_softdevice.hex. 1159720_163 v1.1...
Programming an application 8.5 Programming the firmware After compiling the application, you can program it to the development board. If you configured a SoftDevice to be used, it is programmed together with the application. 1. Connect the development board to your computer. 2.
Programming an application • To create a file, right-click your project or any subfolder in the Project Explorer and select Add New File. By default, the file is created in the project directory. 8.6.2 Including header files Required header files must be linked to your project by adding their path to the user include directories. Header files contain function declarations and macro definitions.
Page 26
Programming an application 5. Click OK. 1159720_163 v1.1...
UART to refer to communication through the to USB CDC ACM bridge, to distinguish it from communication through the Nordic UART Service (NUS) over Bluetooth Low Energy. 9.1 Connecting via RTT directly supports RTT. You can see output in the Debug Terminal during debugging sessions.
Communicating with the board 9.1.2 Connecting via RTT on Linux To communicate via RTT, connect your development board via USB and use SEGGER's J-Link RTT to establish a connection. Note: natively supports RTT. If enabled, the monitor shows up when you start debugging. Alternatively, you can use SEGGER's J-Link RTT Viewer as described below.
Page 29
Communicating with the board 4. Select the correct COM port to connect to the board. To find the correct port, follow these steps: a) Go to the start menu in Windows and type devmgmt.msc to open the Device Manager. b) Scroll down and expand Ports (COM & LPT). c) Find the port named JLink CDC UART Port and note down the number in parentheses.
Testing the application The next step after compiling and programming your application is to test it. Nordic Semiconductor provides its own testing tool, nRF Connect, which is available both for mobile and for desktop. 10.1 Testing with a mobile device If you have a mobile device that supports Bluetooth Low Energy, download the nRF Connect app from Google Play or App Store to test your application.
Testing the application CDC-UART, enter hello and send it to the DK. 8. In a terminal connected via The text is sent through the to your device, which will display it in the nRF Connect log: 10.2 Testing with a computer If you have an nRF51 Dongle or a second DK, you can test your application with nRF Connect for Desktop.
Page 32
Testing the application 8. Find the device and click Connect. The default device name for the ble_app_uart example is "Nordic_UART". UART 9. Select the RX characteristic value. 10.Write 30 31 32 33 34 35 36 37 38 39 (the hexadecimal value for the string "0123456789") and click write.
Debugging To actually see what is happening on the development board while the application is running, you must set up a J-Link debugging session. has an integrated debugger that you can use to step through your application. 1. Open your project in SES. 2.
C/C++ programming with support for Nordic Semiconductor devices, produced by SEGGER Microcontroller. SoftDevice A wireless protocol stack that complements the nRF5 Series SoCs. Nordic Semiconductor provides these stacks as qualified, precompiled binary files. System on Chip (SoC) A microchip that integrates all the necessary electronic circuits and components of a computer or other electronic systems on a single integrated circuit.
Acronyms and abbreviations These acronyms and abbreviations are used in this document. Development Kit GNU Compiler Collection Integrated Development Environment SEGGER Real Time Transfer SEGGER Embedded Studio System on Chip UART Universal Asynchronous Receiver/Transmitter 1159720_163 v1.1...
Nordic Semiconductor ASA customers using or selling these products for use in such applications do so at their own risk and agree to fully indemnify Nordic Semiconductor ASA for any damages resulting from such improper use or sale.
Need help?
Do you have a question about the nRF5 Series: nRF52 and is the answer not in the manual?
Questions and answers