I followed the steps to setup my nRF52 DK with eclipse. I could also build the code without errors. However, when I try to debug it, it says cannot connect to J-Link.
The following is the output on my console
*SEGGER J-Link GDB Server V6.12a Command Line Version
JLinkARM.dll V6.12a (DLL compiled Dec 2 2016 16:44:26)
-----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: localhost only
Generate logfile: off
Verify download: on
Init regs on start: on
Silent mode: off
Single run mode: on
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: SWD
Target interface speed: 1000kHz
Target endian: little*
***Connecting to J-Link...
Connecting to J-Link failed. Connected correctly?
GDBServer will be closed...
Could not connect to J-Link.
Please check power, connection and settings.***
I presume you tried running JFlash or JLink commander to confirm your JLink is working
Yes, I did try running JLink commander.
It says No emulators connected via USB.
Connecting to J-Link via USB...FAILED: Can not connect to J-Link via USB.
So you Jlink is not working.
If you are running Windows, look in the device manager and confirm that you can see the JLink in the "Universal Serial Bus controllers" section (its the section at the bottom)
If you can't see the Jlink there, the chances are that its got a problem.
If you bought your Jlink from eBay or AliExpress, I know that some of these have problems.
I have my suspicions that the JLink software checks whether the Jlink has a blacklisted serial number and if so, it "bricks" it.
There are however ways to unbrick Jlinks, which have been posted on various other forums.
Yeah, I couldn't find Jlink in the "Universal Serial Bus Controllers" section. I suppose I'd get a new one and try it again.
Is there any other way to debug where I don't have to use the Jlink at all, only the DK?
The DK includes a cut down version of JLInk, which can be used for debugging, but is not compatible with JFlash
If you are able to solder etc, I recommend you search for postings that are on various forums that describe how to revive broken Jlinks.
Btw. Depending on what dev toolchain you use, there are other debuggers, e.g. the BlackMagic probe that can be used. ( you can make a Bmp from a generic STM32 board for less than $5)
But only JLink is directly integrated into Keil and IAR and even in Nordic's gcc tool.
So using anything else would take a lot more time and effort.