How to debug an Arduino Nano 33 IoT with GDB?

× Not what you are looking for? Did you want USB/WiFi debug, trace and performance monitoring instead?

The Arduino 33 IoT is a SAMD based board, and is available out of the box for debugging in vMicro, through an external debugger.

External Debug Interface: SWD

A Demo can be seen on  Youtube, and a full walkthrough is on the Arduino project Hub

External Debugger Connections

If you don't have a debugger built-in then you can use an External Debugger which supports SWD to attach to your board, as seen in the examples below.

General NOTE - SWD Interface Connections

On Boards - often just specific pins on your board, or may be presented in a 2x5 interface (its small at [0.05"/1.27mm pitch]), shown in the first image on the "Black Magic Pro" debugger

On Debuggers - may be presented in the small 2x5 interface, or in the JTAG layout.

Bear this in mind when finding a debugger, you may need more leads / breakouts to connect them to your targets.....

 

Specific Example Note

Arduino Nano 33 IOT SWD Pads will need to be connected for the debugger as shown below, and in this case the debugger needs a modification to fully support SWD reliably.

Wiring the Arduino Nano33 IoT to Debugger

 

Software Setup

Ensure you have Visual Studio and the vMicro Extension Installed

Open your Sketch and select the Debug > Hardware, and the relevant Debugger you have available, whether it's built in, or External:

SAMD Debug Toolbar Settings

Start Debugger

  1. Ensure you have the Debug Configuration selected from the Configuration Manager Window
  2. If you know where you want the first breakpoint in your code, add it now
  3. To start the debugging process, you can either:
    • "Debug > Attach to Process" button if your code has already been uploaded to the SAMD board
    • "Debug > Start Debugging" if your code has not been uploaded
Upload Note  - You will need to set the COM port to the Nano port to Upload, as programming is not available at present for this debugger.

SAMD Debugging Arduino Nano 33 IoT in vMicro and Visual Studio

Congratulations - you should have the debugger running, and further windows can be opened from the "Debug > Windows" menu once you have started debugging.

There is also a video guide for this board below:

 

See our GDB Debugging in Brief guide, or our detailed GDB Debugging Tutorial for Arduino to learn more about using the debugging interface.