Skip to content

Flashing nRF boards

paradajz edited this page Apr 5, 2024 · 16 revisions

Supported operating system for flashing nRF boards is Ubuntu 22.04 only.

Prerequisites

Follow this page up to the "Building the firmware section".

Flashing nRF52840 DK (PCA10056)

nRF52840 DK (Development kit) is a development board from Nordic Semiconductor with nRF52840 MCU on it.

Start by plugging the board into PC via both micro USB ports.

Execute the following command in the container:

make flash TARGET=nrf52840dk FLASH_TOOL=nrfjprog

Flashing Arduino Nano 33 BLE and Adafruit ItsyBitsy nRF52840 Express

Arduino Nano 33 BLE:

Adafruit ItsyBitsy nRF52840 Express:

These two boards are nearly identical so their flashing procedure is similar as well. Supported operating system for flashing these boards is Ubuntu only.

In order to flash these boards, an external programmer is required. DAPLink can be used. DAPLink is any board supporting CMSIS-DAP debug protocol. An example board (and the one used for this guide) is this:

This specific board is available on Tindie (no affiliation): https://www.tindie.com/products/johnnywu/mini-daplink-debug-probe/

It's likely that any other DAPLink board will work, but the one above is the only one tested.

Connecting DAPLink with the target board

In order to flash the target board, two signals from DAPLink board need to be connected to the target board. On both of these boards the required signals are exposed as pads, and not as pins. To use them some soldering is required. Both boards also use the same names for the exposed pads:

DAPLink Pin Target Pin
TCK / CK SWCLK
TMS / IO SWDIO
Arduino Nano 33 BLE

Adafruit ItsyBitsy nRF52840 Express

Flashing

Once the development environment is ready and the pins between DAPLink board and target board are connected, the firmware can be built and flashed. Before continuing, make sure both the target and DAPLink boards are plugged into PC. Once the programmer (probe) is connected, run the following command inside the OpenDeck container to get its ID:

pyocd list

The output can vary depending on the probe used, but usually looks similar to this:

(.venv) ubuntu@opendeck ~/workspace/OpenDeck master
> pyocd list
  #   Probe/Board             Unique ID                                          Target         
------------------------------------------------------------------------------------------------
  0   ARM DAPLink CMSIS-DAP   0700008138416c931431353236383648a5a5a5a597969908   ✖︎ stm32f103rb  
      NUCLEO-F103RB

The thing to note here is the Unique ID. Select it and copy it.

The following command should be used to flash both boards:

make flash TARGET=target FLASH_TOOL=pyocd PROBE_ID=unique_id

target and unique_id need to be replaced:

  • target:
    • Arduino Nano 33 BLE: nano33ble
    • Adafruit ItsyBitsy nRF52840 Express: af_ib_nrf52840
  • unique_id: Replace with the actual probe ID, for instance: 0700008138416c931431353236383648a5a5a5a597969908 (ID from above)

Complete command examples with the probe ID from above:

  • Arduino Nano 33 BLE: make flash TARGET=nano33ble FLASH_TOOL=pyocd PROBE_ID=0700008138416c931431353236383648a5a5a5a597969908
  • Adafruit ItsyBitsy nRF52840 Express: make flash TARGET=af_ib_nrf52840 FLASH_TOOL=pyocd PROBE_ID=0700008138416c931431353236383648a5a5a5a597969908
Clone this wiki locally