This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

<JLINK> Connecting to target...ERROR: Could not connect to target

Hi,

I just received nRF52-DK recently.

I am using Ubuntu 16.04 (64-bits) OS.

I installed JLink_Linux_V620b_x86_64.deb and was using nRF5x-Command-Line-Tools_9_6_0_Linux-x86_64.tar

I could download the demo "Heart rate monitor" to the development board.

    nrfjprog -f nrf52 --program heart_rate_demo.hex --sectorerase
    nrfjprog -f nrf52 --reset

I could run the demo with my mobile phone.

However, when I wanted to connect with the J-Link GDB Server.

    JLinkGDBServer -if JTAG -device nRF52832_xxAA

I got the below messages:

    SEGGER J-Link GDB Server V6.20b Command Line Version

    JLinkARM.dll V6.20b (DLL compiled Sep 22 2017 17:58:29)

    Command line: -if JTAG -device nRF52832_xxAA
    -----GDB Server start settings-----
    GDBInit file:                  none
    GDB Server Listening port:     2331
    SWO raw output listening port: 2332
    Terminal I/O port:             2333
    Accept remote connection:      yes
    Generate logfile:              off
    Verify download:               off
    Init regs on start:            off
    Silent mode:                   off
    Single run mode:               off
    Target connection timeout:     0 ms
    ------J-Link related settings------
    J-Link Host interface:         USB
    J-Link script:                 none
    J-Link settings file:          none
    ------Target related settings------
    Target device:                 nRF52832_xxAA
    Target interface:              JTAG
    Target interface speed:        1000kHz
    Target endian:                 little

    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12
    Hardware: V1.00
    S/N: 682083335
    Checking target voltage...
    Target voltage: 3.30 V
    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...
    Could not connect to target.

I have googled many pages with no help.

Please give me some direction. Thanks!

Parents
  • Hi,

    The interface used is SWD, not JTAG. Start the gdb-server like this instead:

    JLinkGDBServer -if swd -device nrf52
    

    Cheers, Håkon

  • I tried both:

    JLinkGDBServer -if JTAG -device nRF52832_xxAA
    
    JLinkGDBServer -if swd -device nrf52

    However I still get the same result J-Link can't connect to target.

    $ JLinkGDBServer -if swd -device nrf52
    SEGGER J-Link GDB Server V6.34a Command Line Version
    
    JLinkARM.dll V6.34a (DLL compiled Aug  8 2018 16:30:24)
    
    Command line: -if swd -device nrf52
    -----GDB Server start settings-----
    GDBInit file:                  none
    GDB Server Listening port:     2331
    SWO raw output listening port: 2332
    Terminal I/O port:             2333
    Accept remote connection:      yes
    Generate logfile:              off
    Verify download:               off
    Init regs on start:            off
    Silent mode:                   off
    Single run mode:               off
    Target connection timeout:     0 ms
    ------J-Link related settings------
    J-Link Host interface:         USB
    J-Link script:                 none
    J-Link settings file:          none
    ------Target related settings------
    Target device:                 nrf52
    Target interface:              SWD
    Target interface speed:        4000kHz
    Target endian:                 little
    
    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 12 2018 11:44:41
    Hardware: V1.00
    S/N: 682392201
    Checking target voltage...
    Target voltage: 3.30 V
    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...
    Could not connect to target.
    

    Basically I can make but I can't make flash because when I attempt to do that I get this error.

    $ make
    DONE nrf52832_xxaa
    $ make flash
    Flashing: _build/nrf52832_xxaa.hex
    nrfjprog -f nrf52 --program _build/nrf52832_xxaa.hex --sectorerase
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: Semiconductor and provide the generated log.log file to them.
    make: *** [flash] Error 33

Reply
  • I tried both:

    JLinkGDBServer -if JTAG -device nRF52832_xxAA
    
    JLinkGDBServer -if swd -device nrf52

    However I still get the same result J-Link can't connect to target.

    $ JLinkGDBServer -if swd -device nrf52
    SEGGER J-Link GDB Server V6.34a Command Line Version
    
    JLinkARM.dll V6.34a (DLL compiled Aug  8 2018 16:30:24)
    
    Command line: -if swd -device nrf52
    -----GDB Server start settings-----
    GDBInit file:                  none
    GDB Server Listening port:     2331
    SWO raw output listening port: 2332
    Terminal I/O port:             2333
    Accept remote connection:      yes
    Generate logfile:              off
    Verify download:               off
    Init regs on start:            off
    Silent mode:                   off
    Single run mode:               off
    Target connection timeout:     0 ms
    ------J-Link related settings------
    J-Link Host interface:         USB
    J-Link script:                 none
    J-Link settings file:          none
    ------Target related settings------
    Target device:                 nrf52
    Target interface:              SWD
    Target interface speed:        4000kHz
    Target endian:                 little
    
    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 12 2018 11:44:41
    Hardware: V1.00
    S/N: 682392201
    Checking target voltage...
    Target voltage: 3.30 V
    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...
    Could not connect to target.
    

    Basically I can make but I can't make flash because when I attempt to do that I get this error.

    $ make
    DONE nrf52832_xxaa
    $ make flash
    Flashing: _build/nrf52832_xxaa.hex
    nrfjprog -f nrf52 --program _build/nrf52832_xxaa.hex --sectorerase
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: Semiconductor and provide the generated log.log file to them.
    make: *** [flash] Error 33

Children
Related