Hi All,
I'm having difficulty with getting a Segger J-link Edu Mini Debugger to work with the RP2040 using Aduino IDE (2.2.1).
For guidance I followed the steps outlined here:
This is what I used for the custom_debug.json file:
{
"servertype": "jlink",
"device": "ATSAMD21G18",
"interface": "SWD",
"serverpath": "/Applications/SEGGER/JLink_V792m/JLinkGDBServerCL"
}
For the device field I also tried RP2040_M0_0 and RP2040_M0_1. When I try launching the debugger, I get this error in the notification window:
"OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output for more details."
The GDB Server Log reports this:
"Waiting for gdb server to start...[2023-10-30T20:44:20.460Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Applications/SEGGER/JLink_V792m/JLinkGDBServerCL -singlerun -nogui -if SWD -port 50000 -swoport 50001 -telnetport 50002 -device ATSAMD21G18
[2023-10-30T20:44:22.650Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start..."
The GDB server appears to be starting, Arduino finds it, then immediately shuts down. Any ideas? Uploading and running sketches outside of J-Link is no problem, just debugging.
The file must be named exactly debug_custom.json (note it is debug_custom, not custom_debug as you named the file).
You definitely can't use ATSAMD21G18 as the device value. That was the device field value used in the tutorial because the tutorial is for the MKR boards that use the ATSAMD21G18 microcontroller. The output you shared from the incorrect configuration is not useful.
Please try it again with the correct filename and the device field in your debug_custom.json file set to RP2040_M0_0. If you still have problems, reply here with the full output produced by the corrected configuration.
With the filename corrected and the device changed to RP2040_M0, an error is shown when I hover mouse cursor over the "greyed out" (darkened) Debug Icon:
Expanding the debug panel from the left side, the contents of the debug_custom file are shown, which appear to be correct, but the configuration panel shows as No Configuration:
There appears to be no way to save the configuration, the configuration panel still says No Configuration, the run debug button is still disabled, now just says that I have no board selected:
What am I missing?? My Mac sees the J-Link board when it's plugged in, I can still upload and run sketches, but now Arduino doesn't run the debugger at all, so no error messages.
You must initialize the debugger by clicking the "Start Debugging" button on the Arduino IDE toolbar. Despite the similar appearance, the Debug icon on the activity bar on the left side of the Arduino IDE window has a significantly different feature in that it only toggles the visibility of the debug panel. The activity bar icon does not initialize the configuration of the debugger.
I installed the latest nightly build, 2.2.2 Nightly 20231101.
There's progress! Not working yet but far fewer errors now:
Waiting for gdb server to start...[2023-11-01T19:40:05.809Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions. /Applications/SEGGER/JLink_V792m/JLinkGDBServerCL -singlerun -nogui -if SWD -port 50000 -swoport 50001 -telnetport 50002 -device RP2040_M0_0 [2023-11-01T19:40:08.003Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed GDB server session ended. This terminal will be reused, waiting for next session to start...
The GDB Server is now found, it's opening, but the J-Link console never appears and the server is apparently closing immediately.
A bit more progress, unplugged the J-Link and the target board, and restarted Arduino. No change in the error, GDB server still starts then closes:
Waiting for gdb server to start...[2023-11-01T20:01:11.609Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Applications/SEGGER/JLink_V792m/JLinkGDBServerCL -singlerun -nogui -if SWD -port 50000 -swoport 50001 -telnetport 50002 -device RP2040_M0_0
[2023-11-01T20:01:13.802Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...