I have been struggling with attempting debug with the Arduino Nano 33 BLE Sense with nRF5280 microcontroller via SWD with the use of the latest Arduino IDE 2.3.2. I have paid attention to the interconnection between the nano and an out-of-the-box Segger EDU mini debugger. While the debugger Commander and J-Link GDB Servers finds the nRF5240, the IDE fails to connect to the gdb server (The IDE cannot find "Arm -CMSIS-DAP). Have I missed something? Comments would be helpful. Thanks.
Hi @smacha. I'm going to ask you to post the full contents of the text shown in the IDE's "gdb-server" panel.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
- Attempt to start the debugger, just as you did before when you encountered the problem.
- Wait for the process to fail.
- Select the "gdb-server" tab in the panel at the bottom of the Arduino IDE window if it is not already selected.
- Right click on the panel at the bottom of the Arduino IDE window.
A context menu will open. - Select "Select All" from the context menu.
All the text in the panel will be selected. - Right click on the panel at the bottom of the Arduino IDE window.
- Select "Copy" from the context menu.
This will copy the selected text to the clipboard. - Open a forum reply here by clicking the "Reply" button.
- Click the
<CODE/>
icon on the post composer toolbar.
This will add the forum's code block markup (```
) to your reply to make sure the debugger output is correctly formatted.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the copied text into the code block. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- Click the "Reply" button to post the output.
[2024-03-08T18:08:14.924Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\smach\\OneDrive\\Documents\\Arduino\\My_SimpleAccelerometer1" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/cmsis-dap.cfg -f "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.1.1/debugger/select_swd.cfg" -f target/nrf52.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
swd
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Error: unable to find a matching CMSIS-DAP device
[2024-03-08T18:08:15.886Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Additional: Invoking J-Link Commander V7.94j and performing a connect via USB
Connecting to target via SWD
InitTarget() start
InitTarget() end - Took 3.18ms
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
[0][5]: E0041000 CID B105900D PID 000BB925 ETM
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M4 identified.
J-Link>
Additional" On start of the SEGGER J-Link GDB Server V7.94j GUI Version
JLinkARM.dll V7.94j (DLL compiled Feb 14 2024 15:36:06)
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 50000
SWO raw output listening port: 50001
Terminal I/O port: 50002
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
Init regs on start: on
Silent mode: off
Single run mode: off
Target connection timeout: 5000 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: nRF52840_xxAA
Target device parameters: none
Target interface: SWD
Target interface speed: 1000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Selected loader 'Default' for flash bank no. 0 ('Internal flash' @ 0x0).
Firmware: J-Link EDU Mini V1 compiled Feb 6 2024 14:37:33
Hardware: V1.00
S/N: 801050646
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.26 V
Listening on TCP/IP port 50000
Connecting to target...
Halting core...
Initializing CPU registers...Connected to target
Waiting for GDB connection...
Please try this:
- Select Tools > Programmer > JLink from the Arduino IDE menus.
- Click the button on the toolbar near the top of the Arduino IDE window that looks like a play button with a bug on it ("Start Debugging").
Hopefully this time the debugger will start up and work as expected.
These are Debug and GDB console results switching programming device from ARM CMSIS-DAP to JLINK. Still no communication.
Debug Console
Cortex-Debug: VSCode debugger extension version 1.5.1 git(be7d3c8+dirty). Usaage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from C:\Users\smach\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-objdump.exe --syms -C -h -w C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf
Reading symbols from c:/users\smach\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf
Launching GDB: "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "C:/Users\\smach\\AppData\\Local\\Temp\\arduino\\sketches\\3845256DD258A2337AFE174DC2024859\\My_SimpleAccelerometer1.ino.elf"
IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems
Launching gdb-server: "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\smach\\OneDrive\\Documents\\Arduino\\My_SimpleAccelerometer1" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/jlink.cfg -f "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.1.1/debugger/select_swd.cfg" -f target/nrf52.cfg
Please check TERMINAL tab (gdb-server) for output from C:\Users\smach\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2/bin/openocd
Finished reading symbols from objdump: Time: 80 ms
OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output for more details.
WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
Reading symbols from C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf...done.
Finished reading symbols from nm: Time: 150 ms
GDB never responded to an interrupt request. Trying to end session anyways
GDB Server Console
[2024-03-10T19:08:38.072Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\smach\\OneDrive\\Documents\\Arduino\\My_SimpleAccelerometer1" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/jlink.cfg -f "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.1.1/debugger/select_swd.cfg" -f target/nrf52.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
swd
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Warn : Failed to open device: LIBUSB_ERROR_NOT_SUPPORTED.
Error: No J-Link device found.
[2024-03-10T19:08:38.163Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
I experienced this error when I had the J-Link drivers provided by SEGGER installed. I was able to fix it by replacing those drivers with the WinUSB driver.
The only problem with doing this is that, if you are also using the J-Link software provided by SEGGER (e.g., "SEGGER J-Link GDB Server"), it only recognizes the J-Link when the SEGGER driver is installed. If that is a problem for you, let me know and I'll provide instructions for an alternative solution. Since this alternative solution is more complicated and inconvenient, I would recommend using the WinUSB driver solution unless you are using the SEGGER software currently. If you later find that you need to use the SEGGER software then you can always install their driver again.
I'll provide instructions you can follow to install the WinUSB driver:
- Download the "Zadig" driver installation tool from this website:
http://zadig.akeo.ie/ - Plug your USBasp into your computer.
- Start "Zadig".
- From the dropdown menu in the "Zadig" window, select "J-Link".
If it doesn't show up on the menu, then select Options > List all devices from the Zadig menus and check again.
- Click the up or down arrows next to the Driver selection box on the right side until you see "WinUSB".
- Click the "Replace Driver" button.
- Wait for the driver replacement process to finish.
- Close the "Zadig" window.
Now click the "Start Debugging" button on the Arduino IDE toolbar again. Hopefully this time it will start up and work as expected.
Thanks. With the install of the WinUSB for J-Link, there is now GDB communication. Debug and GDB server consoles are shown below, where a breakpoint has been met. I now have to get use to working with Arduino debugging. Where does this solution lead Arduino and/or Segger regarding a more seamless resolution to the problem experienced?
Debug Console
Cortex-Debug: VSCode debugger extension version 1.5.1 git(be7d3c8+dirty). Usaage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from C:\Users\smach\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-objdump.exe --syms -C -h -w C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf
Reading symbols from c:/users\smach\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf
Launching GDB: "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "C:/Users\\smach\\AppData\\Local\\Temp\\arduino\\sketches\\3845256DD258A2337AFE174DC2024859\\My_SimpleAccelerometer1.ino.elf"
IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems
Launching gdb-server: "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\smach\\OneDrive\\Documents\\Arduino\\My_SimpleAccelerometer1" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/jlink.cfg -f "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.1.1/debugger/select_swd.cfg" -f target/nrf52.cfg
Please check TERMINAL tab (gdb-server) for output from C:\Users\smach\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2/bin/openocd
WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
Reading symbols from C:/Users\smach\AppData\Local\Temp\arduino\sketches\3845256DD258A2337AFE174DC2024859\My_SimpleAccelerometer1.ino.elf...done.
Finished reading symbols from objdump: Time: 1115 ms
Finished reading symbols from nm: Time: 1103 ms
0x0001dde0 in hal_sleep ()
Program stopped, probably due to a reset and/or halt issued by debugger
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, setup () at C:\Users\smach\OneDrive\Documents\Arduino\My_SimpleAccelerometer1/My_SimpleAccelerometer1.ino:24
24 Serial.begin(9600);
GDB Server Console
Waiting for gdb server to start...[2024-03-11T15:10:49.285Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\smach\\OneDrive\\Documents\\Arduino\\My_SimpleAccelerometer1" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/jlink.cfg -f "C:\\Users\\smach\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.1.1/debugger/select_swd.cfg" -f target/nrf52.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
swd
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : J-Link EDU Mini V1 compiled Feb 6 2024 14:37:33
Info : Hardware version: 1.00
Info : VTarget = 3.259 V
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Info : nRF52840-xxAA(build code: D0) 1024kB Flash, 256kB RAM
undefined debug reason 8 - target needs reset
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00003ef8 msp: 0x20008d48
You are welcome. I'm glad it is working now.
Regards,
Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.