vscode启动debug失败!

我尝试使用vscode进行debug,芯片型号为NRF52840,建立了一个空的工程,尝试编译烧录,这是成功的,但是debug失败


Parents
  • Hello,

    You need to write in English on this forum. To get familiar with developing and debugging with the nRF52, nRF53, and nRF54 family, do check out:

    https://academy.nordicsemi.com/ 

    Kenneth

  • gdp translat:
    Solution Found! White check mark

    I have resolved the debugging issue in VS Code for nRF52840.
    The key solution is to manually start J-Link GDB Server before launching the debugger.

    Steps to Fix:

    1. Manually start J-Link GDB Server before launching VS Code:
      bash
      JLinkGDBServer -device NRF52840_XXAA -if SWD -speed 4000 -port 2331
    2. Open VS Code and start debugging as usual.
      No need to modify launch.json—VS Code will automatically connect to the running GDB Server.

    Why This Works?

    • Sometimes, VS Code tries to start its own GDB Server, which may use a different port (e.g., 46191), causing connection errors.
    • Manually starting JLinkGDBServer ensures the debugger connects correctly to port 2331.

    Thanks to everyone who contributed! Hope this helps others facing the same issue. RocketFire

Reply
  • gdp translat:
    Solution Found! White check mark

    I have resolved the debugging issue in VS Code for nRF52840.
    The key solution is to manually start J-Link GDB Server before launching the debugger.

    Steps to Fix:

    1. Manually start J-Link GDB Server before launching VS Code:
      bash
      JLinkGDBServer -device NRF52840_XXAA -if SWD -speed 4000 -port 2331
    2. Open VS Code and start debugging as usual.
      No need to modify launch.json—VS Code will automatically connect to the running GDB Server.

    Why This Works?

    • Sometimes, VS Code tries to start its own GDB Server, which may use a different port (e.g., 46191), causing connection errors.
    • Manually starting JLinkGDBServer ensures the debugger connects correctly to port 2331.

    Thanks to everyone who contributed! Hope this helps others facing the same issue. RocketFire

Children
  • Final Update: Root Cause Identified! White check mark

    The real issue was not related to VS Code or J-Link GDB Server itself.

    I have an isolation module on the SWD interface because I frequently debug motor drivers. This setup works well in STM32 development environments, but it caused issues with the nRF52840 debugging process.

    Earlier, I mistakenly assumed that manually starting the GDB Server fixed the issue. In reality, it just happened that I removed the isolation module at the same time I manually started the server. This led to a false correlation, making it seem like the external GDB Server was required.

    Final Solution:

    • Removing the SWD isolation module allowed debugging to work normally.
    • Now, VS Code automatically starts the J-Link GDB Server, and everything works without manual intervention.

    Lesson learned! Hopefully, this helps others who might run into similar hardware-related issues. RocketFire

Related