Hi,
Debugging a NRF52 target using PIO Unified Debugger and a JLink V9 / EDU probe on Linux. Starting a debug session works great the first time, but I click the “Stop Debugging” button the JLinkGDBServer is killed and the JLink HW probe is left in a “bad” state. Any future attempts to start a debug session will fail with this error:
Connecting to target…ERROR: Communication timed out: Requested 8 bytes, received 0 bytes !
ERROR: Could not transfer JTAG data.
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed…
.pioinit:11: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer.
The only way to recover is to power cycle the JLink. This has been reported before here: [SOLVED] J-Link is low on memory - J-Link/Flasher related - SEGGER - Forum
As a workaround, I use “pkill JLinkGDBServer” outside of PIO before clicking the “Stop Debugging” button. Then the JLink hardware is de-initialized properly and it is possible to start a new debug session.
Please advice.
Thank you so much that reported this issue. I don’t have J-Link but would be glad if you help to resolve this issue. Could you run this command before pressing “Stop”? Please open “DEBUG CONSOLE” in VSCode and type at the bottom input
monitor q
Now, press stop. You can play with J-Link commands via monitor xxx
, see a list here https://www.segger.com/downloads/jlink/UM08001
Could you try to type just quit
?
quit
Canceled
A debugging session is active.
Inferior 1 [Remote target] will be killed.
Quit anyway?
(y or n) [answered Y; input not from terminal]
GDB closed TCP/IP connection
Yes. Quit works properly, thank you! Please let me know how to make the change so that clicking the “Stop Debugging” button sends a “quit” command instead of killing the GDBServer.
Could you try this beta version of our debugging frontend?
- Download and unzip https://www.dropbox.com/s/77panjmzrswl2i0/platformio-ide-1.4.2-beta.1.vsix.zip?dl=1
- VSCode > View > Command Palette > Install from VSIX
- Restart VSCode after installation.
Does it work better now?
Nope. Same problem.
Getting this when clicking Stop Debugging:
pio_reset_target
Warning! Undefined pio_reset_target command
Cannot execute this command while the target is running.
Use the “interrupt” command to stop the target
and then try again.
Cannot execute this command while the target is running.
Use the “interrupt” command to stop the target
and then try again.
Cannot execute this command while the target is running.
Use the “interrupt” command to stop the target
and then try again.
Followed by:
Connecting to target…ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed…
.pioinit:11: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer.
When trying to debug again. Power cycle JLink is required.
Please file an issue here Issues · platformio/platformio-vscode-ide · GitHub
We will investigate this issue in details ASAP.