JLinkExe works, but JlinkGDBServer gives errors

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • JLinkExe works, but JlinkGDBServer gives errors

    I just got a new dev board for the part we're going to use for this project, but I can't seem to get JLinkGDBServer to connect to it. I have successfully connected, flashed, and run it using JLinkExe, but JLinkGDBServer just says:
    ERROR: Could not connect to target.
    Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
    Any suggestions for what might be different between the two that I can correct to get things working? Complete output from JLinkGDBServer is below:
    $ JlinkGDBServer
    SEGGER J-Link GDB Server V4.62a

    JLinkARM.dll V4.62a (DLL compiled Feb 6 2013 11:45:16)

    The server has been started with the following settings:
    ---Server related settings---
    GDBInit file: none
    Listening port: 2331
    SWO thread listening port: 2332
    Accept remote connection: yes
    Logfile: off
    Verify download: off
    Init regs on start: on
    Silent mode: off
    Single run mode: off
    ---J-Link related settings---
    J-Link script: none
    Target interface: JTAG
    Host interface: USB
    Target endian: little
    Target interface speed: 1000kHz

    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link V9 compiled Jan 11 2013 12:33:03
    Hardware: V9.00
    S/N: 59102303
    Feature(s): GDB
    Checking target voltage...
    Listening on TCP/IP port 2331
    Connecting to target...ERROR: Could not connect to target.
    Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link V9 compiled Jan 11 2013 12:33:03
    Hardware: V9.00
    S/N: 59102303
    Feature(s): GDB
    Checking target voltage...
    Listening on TCP/IP port 2331
    Connecting to target...ERROR: Could not connect to target.
    Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
    Shutting down...
    In contrast, starting up JLinkExe works fine:
    $ JLinkExe
    SEGGER J-Link Commander V4.62a ('?' for help)
    Compiled Feb 6 2013 11:45:20
    DLL version V4.62a, compiled Feb 6 2013 11:45:16
    Firmware: J-Link V9 compiled Jan 11 2013 12:33:03
    Hardware: V9.00
    S/N: 59102303
    Feature(s): GDB
    VTarget = 3.237V
    Info: Could not measure total IR len. TDO is constant high.
    Info: Could not measure total IR len. TDO is constant high.
    No devices found on JTAG chain. Trying to find device on SWD.
    Info: Found SWD-DP with ID 0x2BA01477
    Info: TPIU fitted.
    Info: ETM fitted.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: Found Cortex-M3 r2p1, Little endian.
    Cortex-M3 identified.
    JTAG speed: 100 kHz
    J-Link>h
    R0 = 00000000, R1 = A5A5A5A5, R2 = A5A5A5A5, R3 = A5A5A5A5
    R4 = A5A5A5A5, R5 = 20000420, R6 = A5A5A5A5, R7 = 20001F28
    R8 = A5A5A5A5, R9 = A5A5A5A5, R10= A5A5A5A5, R11= A5A5A5A5
    R12= A5A5A5A5, R13= 20001F20, MSP= 20007FE0, PSP= 20001F20
    R14(LR) = 00003617, R15(PC) = 00003606
    XPSR = 61000000, APSR = 60000000, EPSR = 01000000, IPSR = 00000000
    CFBP = 02000000, CONTROL = 02, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    CycleCnt = 00000000
    J-Link>r
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    J-Link>g
    J-Link>
  • Hi,

    Short explanation:
    For Cortex-M there are in general two debug interfaces available:
    JTAG (5 signals: TCK, TMS, TDI, TDO, TRST)
    SWD (2 Signals: SWCLK, SWDIO)

    J-Link Commander tries to find anything on all interfaces supported by the connected J-Link by default.
    This is somewhat historical and not really the best way to proceed, since communicating on an interface that the target does not support may confuse it.
    The idea is, to tell J-Link what interface to search on.
    In your case, it seems that only the signals for SWD are connected and so only a connection via SWD can be established, so you need to tell GDBServer to use SWD as interface. Default is JTAG.


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.