Blog Datasheets Home About me Clients My work Services Contact

G2Labs Grzegorz Grzęda

Getting started with the nRF52 development kit

November 7, 2023

Getting Started with the nRF52 Development Kit

The Nordic nRF52 development kit is a powerful tool for developing applications on the nRF52 series of microcontrollers. It provides an easy-to-use platform for rapid prototyping and evaluation of Bluetooth Low Energy (BLE) and other wireless applications. In this guide, we’ll walk through the steps to help you get started with the nRF52 development kit.

Setting Up the Environment

Before we dive into the examples and explanations, let’s first set up our development environment. Here are the steps to follow:

  1. Install the nRF5 SDK: Download the latest version of the nRF5 SDK from Nordic Semiconductor’s website and follow the installation instructions for your operating system.

  2. Install a toolchain: To compile the code for the nRF52 development kit, you’ll need a toolchain. Nordic provides its own toolchain called nRF5x Command Line Tools. Download and install it from their website.

  3. Install an IDE: While you can use any text editor for development, using an Integrated Development Environment (IDE) can greatly enhance your productivity. Nordic’s recommended IDE is Segger Embedded Studio, but you can also use Keil MDK or Eclipse with the appropriate plugins.

  4. Connect the development kit: Connect the nRF52 development kit to your computer using the provided USB cable. Ensure that the board gets recognized by the operating system.

With the environment set up, let’s move on to some example code to understand how to work with the nRF52 development kit.

Example: Blinking LED

The classic “Hello World” equivalent in the embedded world is blinking an LED. Let’s see how to achieve that using the nRF5 SDK:

  1. Create a new project: Open your IDE and create a new nRF5 SDK project. Specify the target nRF52 development kit and choose an appropriate project template or start with an empty project.

  2. Configure the GPIO: In the newly created project, locate the board configuration file (e.g., board.h) and find the definition for the LED pin. Set the pin as an output by defining it as a GPIO output with the appropriate pin number, port, and mode.

  3. Implement the blinking logic: Open the main application file (e.g., main.c) and implement the following code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include "boards.h"
#include "nrf_delay.h"

int main(void)
{
    // Initialize the LED pin
    bsp_board_init(BSP_INIT_LEDS);

    while (true)
    {
        // Turn on the LED
        bsp_board_led_on(0);
        nrf_delay_ms(500);
        // Turn off the LED
        bsp_board_led_off(0);
        nrf_delay_ms(500);
    }
}
  1. Build and flash the firmware: Compile the code and flash the generated firmware onto the development kit. Your LED should start blinking at a 1-second interval.

Congratulations! You have successfully written and executed your first program on the nRF52 development kit.

Conclusion

In this guide, we covered the steps to set up your development environment and walked through an example of blinking an LED using the nRF5 SDK. The nRF52 development kit is a versatile platform for building BLE and wireless applications. With the SDK’s rich features and the kit’s extensive peripherals, you have all the tools you need to start exploring and creating innovative applications.


➡️ Understanding the GPIOs on the nRF52


⬅️ Introduction to the nRF52 microcontroller: features and capabilities


Go back to Posts.