Arduino In-circuit Debugging with PlatformIO

The Board

Arduino Nano 33 IoT
Bottom side of Arduino Nano 33 IoT
Debug port pads

The Debug Adapter

J-Link Debug Adapter

Connecting the Adapter

Wires soldered to the debug port
J-Link Pinout for Serial Wire Debug (SWD)

Debug Your Program

[env:nano_33_iot]
platform = atmelsam
board = nano_33_iot
framework = arduino
debug_tool = jlinklib_deps =
Arduino_LSM6DS3
#include <Arduino.h>
#include <Arduino_LSM6DS3.h>
void setup() {
Serial.begin(9600);
// Wait for serial connection to be ready
while (!Serial);
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU");
while (1);
}

Serial.print("Gyroscope sample rate = ");
Serial.print(IMU.gyroscopeSampleRate());
Serial.println(" Hz");
Serial.println();
Serial.println("Gyroscope in degrees/second");
Serial.println("X, Y, Z");
}
void loop() {
float x, y, z;

if (IMU.gyroscopeAvailable()) {
IMU.readGyroscope(x, y, z);

Serial.print(x);
Serial.print(", ");
Serial.print(y);
Serial.print(", ");
Serial.println(z);
}
}
PlatformIO debugging session: debug view, configuration selection, start, first breakpoint
PlatformIO debug session: breakpoint, continue execution, serial connection check, variable inspection

Other Arduino Boards

Debug Port Pads on Arduino MKR Boards

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store