The Feather M0 can be used in debug mode using the SEGGER J-LINK programmer. It needs just a little extra effort to get set up. On the bottom side of the feather M0 (this is the Bluefruit LE model) there are exposed pads for the SWCLK and SWDIO pins which are required for JTAG programming. The SWCLK and SWDIO are actualy in two places on the bottom (use the green circles above) and avoid the red crossed out square pads.

These four pins must be connected to the Segger J-Link debugger along with a USB cord to power the circuit. 

  • Feather M0 [pin2] (Vcc) J-Link SWD [pin 1] (Vcc)
  • Feather M0 [pin3] (GND) J-Link SWD [pin 3,5,9] (GND)
  • Feather M0 [SWCLK] J-Link SWD [pin 4]
  • Feather M0 [SWDIO] J-Link SWD [pin 2]

Making a custom featherwing board will be much more convenient than manually wiring each connection into the J-Link 2x10 header.


In order to use a Feather M0 for debugging some connections need to be made to the Segger J-Link JTAG Debugger. The following parts can be used to create a JTAG FeatherWing:

You can also use our SWD breakout board:

This adapter board is designed to make it easier to use ARM dev boards that use slimmer 2x5 (0.05"/1.27mm pitch) SWD cables for programming.  It's helpful for using...
In Stock

The above schematic is for the Feather M0 with JTAG connections. It includes two connectors. The top right is the SWD (2x5) shrouded JTAG connector. The bottom right connector is Adafruit's JST-PH-2-Pin SMT Right Angle Connector used to connect the a JST cable to the SWDIO and SWCLK (circular not square) pads on the bottom side of the Feather M0 boards. Download the schematic file here.

Featherwing board layout in Eagle format.  You can also access the gerber files here if you are not an Eagle user.

This is how Otherplan (the milling software that is free from Othermill) renders the board. It took about 10 minutes to mill, switch bits drill and cut out this single sided PCB. I used the following bits:

Otherplan can read Eagle BRD files directly or you can import your own gerbers. 

Blank single sided FR1 PCB mounted up and milled in the Othermill. 

The traces came out just perfect and with the PCB in hand we can go ahead and solder it up.

Place and solder the SWD JTAG connector (2.5 1.27mm). 

Solder the 2-pin JST connector. 

Solder the short feather male headers. Short side up with the black plastic on the bottom. The only pins that need to be soldered are the ones with traces running to them (pins 2 and 4). I recommend at least soldering the end pins on each side to secure the headers.

Mount the JTAG debug featherwing to your Feather M0 module.

Go ahead and solder the JST pigtail connector to the bottom of your Feather M0 module. If you wish to run the leads through the Feather and FeatherWing mount holes that might make the wires look a little neater.

  • JST red lead SWCLK
  • JST black lead SWDIO

Plug in 2-pin JST connector to JTAG FeatherWing.

Be sure that Arduino --> Preferences --> Additional Boards Manager URLs contains:

Launch the Arduino app and select Tools --> Board --> Boards Manager. 

Use the search field and install both the SAMD Board packages. One is from Arduino and the other is from Adafruit. 

Plug in your Feather M0. Make sure the following is selected under Arduino --> Tools:

  • Board: "Adafruit Feather M0 (Native USB Port)"
  • Port: "/dev/cu.usbmodem14211 (Adafruit Feather M0 (Native USB Port)" - or whatever the port is.

An ELF binary file is necessary for debugging with JTAG. In order to locate the file we will enable both of these:

"Show verbose output during:  X compilation  X upload"

The lower window which shows the compile process has the ELF files path and name highlighted. Not this as it will be necessary when launching gdb. 

Download and install the latest copy of the J-Link GDB server from Segger's site. This is available for Windows/OS X/Linux.

On a mac, we run

$ brew install gcc-arm-none-eabi

We want to install an ARM based GDB client. The easiest way to do this on OS/X is to use BREW. We can search for the latest versions with the above command then install it.

Get Yourself Connected

Go ahead and plug in the following. This will be necessary for all debugging sessions.

  • Micro USB Feather <--> USB Computer
  • Segger J-Link USB <--> USB Computer
  • Make sure JST 2-pin connector is plugged in
  • Make sure J-Link is connected to Adafruit Board and the SWD 2x5 ribbon is connected to the FeatherWing Header Board we have made.


$ sudo /usr/local/bin/JLinkGDBServer \ 
  -device Cortex-M0 -speed auto -if SWD

Launch the  J-Link GDB server from the command line. 

This is what it looks like when the GDB Server is launched and waiting for a the GDB client to connect.

.gdbinit file

target remote localhost:2331 
monitor device Cortex-M0 
monitor speed auto
file /var/folders/_t/fsyrnxxs53v59j1l1xkn9k8r0000gp/T/arduino_build_244528/feather-m0.ino.elf
monitor reset

A .gdbinit file in your home directory ~/.gdbinit will greatly improve your quality of life when debugging. It gets around the problem of needing to remember the command sequence, connection ports and file paths to get the debugger going.

GDB client

$ /usr/local/bin/arm-none-eabi-gdb

The above command will start the gdb client.

and we are off...Now the code is running in full debug mode on our Feather M0 board.

I've found these commands to be the most useful when using gdb:

  • continue # execute code
  • ^C # stop code get debugger prompt
  • print # shows value
  • list <line#> - shows code
  • next - execute next line of code
  • break <line#> - stop code ehre
  • info breakpoints # shows breakpoints
  • del <breakpoint#> # deletes breakpoints
  • quit # exits GDB
(gdb) continue
(gdb) ^C
(gdb) print
(gdb) list
(gdb) next
(gdb) break
(gdb) info breakpoints
(gdb) del
(gdb) quit

This guide was first published on Jan 30, 2017. It was last updated on Jan 30, 2017.