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.
What you'll need¶
- 1x Pitaya-Link Debug Probe
- A macOS/Linux/Windows PC
- An nRF52 target board(e.g. nRF52840 MDK USB Dongle)
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:
Alternatively, you can install the latest prerelease version from the HEAD of the develop
branch, you can do the following:
Verify if pyOCD works correctly in your terminal:
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 device with these subcommands:
gdbserver
: GDB remote server allows you to debug using gdb via either the console or several GUI debugger options.load
: Program files of various formats into flash or RAM.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.server
: Share a debug probe with a TCP/IP server.reset
: Hardware or software reset of a device.rtt
: Stream Segger RTT IO with any debug probe.list
: Show connected devices.
You can get additional help by adding --help
option.
To load/erase the nRF52840-based target, open up a terminal and run:
Explore Further¶
Now that you are familiar with the Pitaya-Link, it's time to explore more tutorials available below: