nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Using the SDK with other boards

The nrf51 SDK supports the current Nordic Semiconductor development board. You can also enable support for another board by selecting a specific supported Nordic Semiconductor board or by defining a custom board. In this way, you can run the SDK examples on any target board.

Supported boards

By default, the SDK project files must be used with specific Nordic Semiconductor boards, usually the most current board. However, the SDK provides support for other boards as well.

The following boards are supported:

Board #define
nRF6310 (part of nRFgo Starter Kit) BOARD_NRF6310
PCA10000 (nRF51822 USB dongle) BOARD_PCA10000
PCA10001 (part of nRF51822 Evaluation Kit) BOARD_PCA10001
PCA10002 (nRF51422 USB dongle) BOARD_PCA10002
PCA10003 (part of nRF51422 Evaluation Kit, BLE + ANT) BOARD_PCA10003
PCA10028 (part of nRF51422 Evaluation Kit, Arduino form factor) BOARD_PCA10028
PCA10031 (nRF51422 USB dongle) BOARD_PCA10031
PCA20006 (nRF51822 Beacon board) BOARD_PCA20006
WT51822 (Wavetek shield) BOARD_WT51822
Custom board (definition in custom_board.h) BOARD_CUSTOM

Enabling support for a board

To enable support for an older Nordic Semiconductor board or a custom board, you must include a define statement for the board that you want to use before you compile the code.

According to the define statement, the suitable board support file is selected. The board support file defines the peripherals, thus the location of LEDs and buttons, for the selected platform. The header files for supported boards are located in the directory nrf51\examples\bsp. The actual selection of the file according to the define statement is done in boards.h.

Depending on the device on the legacy board, you might need to change the memory layout. PCA10028 and PCA10031 have 32 kB RAM, so if you want to use older boards with 16 kB RAM, you must decrease the size of IRAM1 by 16 kB (0x4000 in hex). In Keil, click Project > Options for Target '...' and modify the values for "Read/Write Memory Area". For GCC, change the linked *.ld file in the Makefile.

Adding support for a custom board

To add support for a custom board, you must create a custom board support file with the name custom_board.h. This file must be located in a directory in the Include path. You can then select to use the custom board by adding the define statement #define BOARD_CUSTOM.

The easiest way to create the custom_board.h file is to start with an existing platform definition file and adapt it to your needs.

A platform example definition looks as follows:

// Defines the number of LEDs. In this example, there is a single RGB LED.
#define LEDS_NUMBER 3
// Defines which PIOs control the color of the LED.
#define LED_START 21
#define LED_RGB_RED 21
#define LED_RGB_GREEN 22
#define LED_RGB_BLUE 23
#define LED_STOP 23
// Defines an RGB LED as 3 single LEDs.
#define BSP_LED_0 LED_RGB_RED
#define BSP_LED_1 LED_RGB_GREEN
#define BSP_LED_2 LED_RGB_BLUE
#define LED_RGB_RED_MASK (1<<LED_RGB_RED)
#define LED_RGB_GREEN_MASK (1<<LED_RGB_GREEN)
#define LED_RGB_BLUE_MASK (1<<LED_RGB_BLUE)
#define BSP_LED_0_MASK (1<<BSP_LED_0)
#define BSP_LED_1_MASK (1<<BSP_LED_1)
#define BSP_LED_2_MASK (1<<BSP_LED_2)
#define LEDS_MASK (BSP_LED_0_MASK | BSP_LED_1_MASK | BSP_LED_2_MASK)
// Defines which LEDs are lit when the signal is low. In this example,
// all LEDs are lit.
#define LEDS_INV_MASK LEDS_MASK
// Defines the user buttons. In this example, there are no user buttons.
#define BUTTONS_NUMBER 0
#define BUTTONS_MASK 0x00000000
// Defines the UART connection with J-Link.
#define RX_PIN_NUMBER 11
#define TX_PIN_NUMBER 9
#define CTS_PIN_NUMBER 10
#define RTS_PIN_NUMBER 8
#define HWFC true