nRF52840 Advanced Development With the nRF5 SDK

Pages
Contributors: jimblom
Favorited Favorite 6

SDK Tips and Tricks

Configuring sdk_config

From the last example, I dare you to peek at the contents of sparkfun_nrf52840_mini/config/sdk_config.h. You'll be greeted with a 13k-line header full of #define macros.

Each of the #defines in sdk_config.h either slightly or drastically alter the performance of your application. It's a powerful file, but it is overwhelming. If you have Java installed, you can type:

language:makefile
make sdk_config

To open a CMSIS Config Wizard. This window allows you to navigate through a list of sorted config macros, and make changes graphically.

CMSIS Config Wizard

If you don't have Java, check out this next section on Backend-Logging...

Backend-Logging

Most application examples, unfortunately, don't log anything to a USB serial port. But! Most examples do support UART-based logging, but you have to enable it.

Search your config file for NRF_LOG_BACKEND_UART_ENABLED. Set it to 1, then set NRF_LOG_BACKEND_UART_TX_PIN to 17 (or any other pin you'd like to use as TX).

Now, if you hook up a Serial Basic or similar USB-to-serial board from RX on the basic to pin 17 on the nRF52840, you should begin to get debug prints.

Backend logging via UART

USB CDC (serial over USB) logging is, unfortunately, not currently supported.

Enabling pins 9 and 10 as GPIO

By default pins 9 and 10, towards the bottom of the board, are only to be used as NFC pins. You can change this by adding the following defines to your Makefile:

language:makefile
ASMFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS

Linker Script's Memory Organization

We have been made aware of a possible issue in the configuration of the memory region for the BLE blinky example. For more details on the issue, users can check out the forum post. If other users also run into issues, they can try this configuration instead (has not been tested or verified):

Note: Unfortunately, with the COVID-19 restrictions this has not been tested or verified by our team.
MEMORY
{
  FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
  RAM (rwx) :  ORIGIN = 0x200022e0, LENGTH = 0x3dd20
}

System Paths

Users may run into issues with their file paths when trying to run make. Make sure you are in the same directory as the Makefile, illustrated in the image below. Additionally, users may need to add system paths for Windows 10.

gif showing added build packages and compile
Notice the file path in the left hand column and terminal.