So, let’s define them within our custom_board.h file:
ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
Post comments on this article and find any associated files and/or downloads at
of examples. It also provides nRF5x drivers and nRF5x
libraries. Installation of the Keil C compiler and
Nordic SDK are detailed on the Keil and Nordic
websites, so we won’t spend any time on the
firmware tool installation process.
We will base our initial code on a template
that is found in the SDK examples/peripheral
directory. Version 12 of the SDK introduced
the sdk_config.h file and Configuration Wizard,
which are used to configure the nRF drivers and
libraries. This makes keeping up with who’s on
the BLE playing field a bit easier.
Programming and debugging duties will be
handled by a Segger J-Link Pro. The J-Link Pro
is fast, easy to use, and reliable. The Keil MDK
fully supports the J-Link Pro.
Setting Up the Compilation
The first order of business is to make
sure we can use the nRF52832’s GPIO pins
assigned to drive the pair of LEDs native to the
development board, which happen to be driven
n SCHEMATIC 1. This drawing is greatly simplified as all of the BLE
with the pins we have assigned to drive the blue
radio circuitry is contained within the Raytac BLE module. An external
and red LEDs. Since we have stepped out of the
32.768 kHz crystal is included in the design to enable all of the
box with our LED assignment, we also need to
nRF52832 clock features.
register our LED I/O pins with the SDK’s board
support package firmware.
nRF52832 source code. The nRF5 SDK includes a wealth
Disabling the NFC default pin assignment is as easy
as typing CONFIG_NFCT_PINS_AS_GPIOS in the C/
C++ options window. You can see that the NFC-disabling
configuration phrase has been entered in the Preprocessor
Symbols area of Screenshot 1. The board support
package registration consumes two steps. The first step
has been taken with the entry of BOARD_CUSTOM in the
Preprocessor Symbols definition area, which can also be
seen in Screenshot 1.
The second step in the board support package
registration process entails creating a custom board
support file called custom_board.h. The nRF5 SDK
recognizes this file as the file in which our custom board
peripheral pin assignments are kept. We have two LEDs.
#define LEDS_NUMBER 2
#define LED_START 9
#define LED_1 9
n SCREENSHOT 1. The Options window allows us to
#define LED_2 10
control how the hardware behaves. We can define things
#define LED_STOP 10
such as memory boundaries and what device will be used
#define BSP_LED_0 LED_1
to program the nRF52832.
#define BSP_LED_1 LED_2
December 2016 53