Skip to content
Programming nRF5x SoCs with Pitaya-Link

Programming nRF5x SoCs with Pitaya-Link

Introduction

Pitaya-Link is a low-cost debug probe based on the CMSIS-DAP (also known as DAPLink) protocol standard. It can be used to program and debug the application software running on Arm Cortex Microcontrollers.

The design enables developers with Drag-And-Drop programming, Virtual COM Port, CMSIS-DAP compliant debug channel, and access to Arm Cortex Microcontrollers in the browser using WebUSB.

The probe comes with indicator LEDs, a button to reset the target or trigger the firmware update, reversible USB-C connector and easy-to-use 7-pin 2.54mm Header.


This post is intended to assist users in the initial setup and demonstration of programming Nordic's nRF5x SoCs with Pitaya-Link.

What you'll need

Installing pyOCD

pyOCD is an open source Python package for programming and debugging Arm Cortex-M microcontrollers using multiple supported types of USB debug probes. It is fully cross-platform, with support for Linux, macOS, and Windows.

The latest stable version of pyOCD may be installed via pip as follows:

pip install -U pyocd

Alternatively, you can install the latest prerelease version from the HEAD of the master branch, you can do the following:

pip install --pre -U https://github.com/mbedmicro/pyOCD/archive/master.zip

Verify if pyOCD works correctly in your terminal:

pyocd --version

Connecting the target

Perform the following steps to connect your nRF5x target board:

  • Connect the target board to Pitaya-Link using the provided 7-pin Cable.
  • Connect Pitaya-Link to the PC using the provided USB-C Cable.
  • A disk drive called PITAYA-LINK will be automatically detected by the computer.

Programming

Pitaya-Link allows programming of your target MCU in the following two very simple ways:

  • Intuitive Drag-And-Drop programming
  • Using the pyocd executable

Drag-and-drop programming

Drag-And-Drop is an optional intuitive programming feature. It allows programming of your target MCU by dragging and dropping a file ( .hex -format) onto the PITAYA-LINK drive.

There is no need to install application software. Anyone that can drag and drop a file to a USB memory stick can now program the target board.

Using the pyocd executable

The pyocd command line tool gives you total control over your target with these subcommands:

  • gdbserver: GDB remote server allows you to debug using gdb via either GNU MCU Eclipse plug-in or the console.
  • flash: Program files of various formats into flash memory.
  • erase: Erase part or all of an MCU's flash memory.
  • pack: Manage CMSIS Device Family Packs that provide additional target device support.
  • commander: Interactive REPL control and inspection of the MCU.
    list: Show connected devices.

You can get additional help by running subcommands with --help option, e.g. pyocd flash --help.

The following commands demonstrate how to flash/erase an nRF52840-based target:

  • To erase all of the target flash:
    pyocd erase -t nrf52840 --chip
    
  • To flash the target with .hex-format firmware:
    pyocd flash -t nrf52840 Sample.hex
    
  • To flash the target with a plain binary:
    pyocd flash -t nrf52840 --base-address 0x1000 Sample.bin
    

Explore Further

Now that you are familiar with the Pitaya-Link, it's time to explore more tutorials available below:

Back to blog