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

nrfjprog failure, if connected with two devices and JLinkExe runs

Sometimes, when I want to use the nrfjprog tool, I get the following error:

nrfjprog --log -f nrf52 --reset

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.

The content of the log.log:

--------------------------------------------------------------------------------
nrfjprog --log -f nrf52 --reset
nrfjprog verion 9.7.2
--------------------------------------------------------------------------------
FUNCTION: open_dll.
FUNCTION: open_dll.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_without_snr.
FUNCTION: enum_emu_snr.
JLinkARM.dll OpenEx returned error 'Cannot connect to J-Link via USB.'.
FUNCTION: close_dll.
FUNCTION: close_dll.

I can reproduce this bug, if I connect two NRF52840 PDK boards on the pc and apply the following steps:

nrfjprog --log -f nrf52 --reset -s $SN1

nrfjprog --log -f nrf52 --reset -s $SN2

JLinkExe -device NRF52832_XXAA -if SWD -speed 4000 -autoconnect 1 -SelectEmuBySN $SN1 -RTTTelnetPort 9101

JLinkExe -device NRF52832_XXAA -if SWD -speed 4000 -autoconnect 1 -SelectEmuBySN $SN2 -RTTTelnetPort 9102

and if I then do the following:

nrfjprog --log -f nrf52 --reset -s $SN1

I get the error above.


Are there any Fixes for this issue?


UPDATE: I found out, that one of the devices can be programmed(resetted), while it is connected via JLinkExe, but the other one can't. I am using the latest Segger Tools v630g.

UPDATE 2: I am using Linux (Ubuntu 16.04)

  • Hi, 

    It should be possible to have multiple jlink instances connected to the same programmer, and was unable to reproduce this issue on Windows. Have you tried to use the latest Segger driver:  https://www.segger.com/downloads/jlink/?

    I guess a possible work-around could be to reset the device from  the existing Jlink commander instance instead of opening a new nrfjprog instance. 

  • hi,

    the problem is not, that there are multiple jlink instances on one programmer, the problem arises, if I use two PDK boards and start on both the JLinkExe.

    I have already downloaded the latest JLink Drivers (v630g), but the problem persists. (I.e. If I connect two boards and start on both of them the JLinkExe, I can't program one of the devices, while the other one works just fine.)

  • RTT could use more than one TCP port, try using -RTTTelnetPort 9201

  • Thanks for this idea, I tried it, but it didn't solve the problem.

  • Vidar refers to that each JLink.exe or nrfjprog.exe instance creates a new instance of the jlink library, and a new connection to the programmer.

    As he mentions though, that shouldn't be an issue, as multiple connections is supported.

    When running those commands, do you run them one after the other in CMD/run, or do you use something to spawn the processes? (Python subprocess fex?)

1 2