Unless you purchased an nRF52840 board from Adafruit, you probably don't have the right bootloader installed. If you have a PCA10056 (Nordic nRF52840 DevKit) it comes blank, for example

However, with a JLink its super easy to install the bootloader. On the PCA10056 the JLink is even built in!

For this step, plug your computer's USB cable into the MicroUSB port right above the battery.

Disable Mass Storage on PCA10056 J-Link

The J-Link firmware on the PCA10056 implement USB Mass Storage, but this causes a known conflict with reliable USB CDC serial port communication. In order to use the serial bootloader, you must disable MSD support on the Segger J-Link!

To disable mass storage support, run the J-Link commander, JLink or  JLinkExe (or equivalent) command

and send MSDDisable. (You can re-enable MSD support via MSDEnable):

    $ JLinkExe
SEGGER J-Link Commander V6.20f (Compiled Oct 13 2017 17:20:01)
DLL version V6.20f, compiled Oct 13 2017 17:19:52

Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12
Hardware version: V1.00
S/N: 683947110
VTref = 3.300V

Type "connect" to establish a target connection, '?' for help
Probe configured successfully.

Then unplug-replug the dev board. The JLINK disk drive will no longer appear. If you ever want, you can re-enable it later.



Install nrfjprog

You will almost certainly need to run nordic's nrfjprog tool to burn bootloaders or code

You will first need to install the nrfjprog tool from Nordic Semiconductors for your operating system. The binary files can be downloaded via the following page: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF5-Command-Line-Tools

You will then need to add the nrfjprog folder to your system PATH variable so that it is available from the command line. The exact process for this is OS specific, but on a POSIX type system like OS X or Linux, you can temporarily add the location to your PATH environment variables as follows:

$ export PATH=$PATH:YOURPATHHERE/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog/

But it really depends on your shell and OS. Basically just make sure you can run nrfjprog on the command line. You can test this by running the following command:

$ nrfjprog --version
nrfjprog version: 9.7.2
JLinkARM.dll version: 6.20f

You may have slightly different version numbers above

git clone nRF52840 Bootloader

git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader into a handy directory, then open up a terminal in that location and run

git submodule update --init --recursive

Flash the Bootloader with nrfjprog

This operation only needs to be done once, and only on boards that don't already have the serial bootloader installed.

nrfjprog is nordic's helper program that will talk to JLink devices - the DK has a JLink built into it. You could also use these commands with a everyday JLink and a custom board with SWD port

Erase chip

Once nrfjprog is installed and available in PATH you can test nrfjprog and also erase your chip with:

    nrfjprog -f nrf52 --eraseall

If you get an error that there is no debugger connected to the PC, check you're plugged into the right port, and have JLink software/drivers installed

Compiling latest bootloader from source

You can then burn the version you see with a line that matches the subdirectory (e.g. pca10056 or feather_nrf52840_express) and then the version number:

make BOARD=pca10056 clean
make BOARD=pca10056 sd
make BOARD=pca10056 flash


Plug a USB cable into the nRF52 USB microUSB port (not the JLink port) and you should see a new disk drive appear:

It contains a INFO_UF2.txt for reading the details of the bootloader.

If you can't flash directly from the 'make' command, you can create a bootloader hex file with the 'genhex' flag.

make BOARD=pca10056 genhex

Then you can directly burn the hex file with:

nrfjprog -f nrf52 --program pca10056_bootloader.hex

This guide was first published on Aug 29, 2018. It was last updated on Aug 29, 2018.

This page (nRF52840 Bootloader) was last updated on Jun 22, 2018.

Text editor powered by tinymce.