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

How to flash a Zephyr RTOS sample project to the nrf52840 dongle using J-Link Base debugger and SWD

Hi,

I'm a beginner at this, I'm a software developer so I've never worked with hardware but now I need to and I don't seem to be able to make it work.

I would need help from top to bottom as to how can I flash a Zephyr RTOS sample project to the nrf52840 dongle using J-Link Base debugger and SWD.

Here's what I have so far:

Ubuntu 20.04

Zephyr RTOS

J-Link software installed and physical debugger -> Adafruit JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board -> TagConnect TC2050-IDC-NL-050-ALL cable -> nrf52840 dongle

I've had this error trying to flash a sample project to the dongle:

-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner jlink
-- runners.jlink: Flashing file: /home/anon/zephyrproject/zephyr/samples/bluetooth/hci_usb/build/zephyr/zephyr.hex
SEGGER J-Link Commander V7.20 (Compiled Apr 28 2021 17:38:41)
DLL version V7.20, compiled Apr 28 2021 17:38:26


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Apr 27 2021 16:36:21
Hardware version: V11.00
S/N: 51015130
License(s): GDB
VTref=0.000V
Target connection not established yet but required for command.
Device "NRF52" selected.


Connecting to target via SWD
Cannot connect to target.

Target connection not established yet but required for command.
Device "NRF52" selected.


Connecting to target via SWD
Cannot connect to target.

Target connection not established yet but required for command.
Device "NRF52" selected.


Connecting to target via SWD
Cannot connect to target.

Writing failed.

Reading failed.


Script processing completed.

I've read somewhere that a problem could be VTref=0.000V so I figured the dongle needs some electricity so I connected it to a usb hub, turns the green light on the J-Link off, connected it to a pc, same, the same pc that was trying to flash it, same, to a plug on the wall, same.

When the dongle is connected to a usb hub the light turns red but the J-Link is off, when I disconnect it, the J-Link turns back to green and the dongle is off.

I have absolutely no idea what to do, I've been at it for months ( I didn't even know about J-Link until recently ) and I've read that the dongle could be faulty so I bought multiple and they all have the same problem.

Thank you so much for your help.

  • It may seem as you have some electrical problems. Are you sure the board is powered properly, and that you have connected both vdd/vtg, gnd, swdio and swdclk from the j-link to the target board? I recommend to order yourself an nRF52840-DK, this should work out of the box.

    Kenneth

  • Hi,

    Thank you for your answer.

    What kind of electrical problems could it be ? I don't know if the board is powered properly as I don't know how to have power going through it while connected to the J-Link, is the J-Link supposed to provide power to the board ?

    I haven't connected anything else but SWD to the board as I thought it was enough just as I saw it on a tutorial, here are some pictures:

    Are the vdd/vtg, gnd, swdio and swdclk the things we need to connect with a breadboard and cables ?

    I would love to order a DK but after having spent $600 on the J-Link I'd like to make it work haha, also I saw on every website people recommending J-Link because it worked well with Nordic boards so I know I'm doing something wrong, but please help me figure it out.

  • The board you want to program or debug needs to be powered, for instance through USB or other power supply. After ensuring your board is powered the next step is to attach the j-link programmer.

    The j-link programmer need to connect 4 pins in total:

    GND, SWDIO, SWDCLK and VDD.

    VDD needs to be connected to the Vtarget of the j-link programmer, VDD is used set SWDIO and SWDCLK to the correct voltage levels.

    Kenneth

  • I see, and does the plug of nails connector connect to all these pins ? How can I power the dongle without the J-Link disconnecting ? What is a way to do it that prevents what I've said in my fist post such as the J-Link's green light turning off ?

    Thank you for helping Kenneth you're saving me right now

Related