Trouble using nrfjprog

I am moving from SES to Visual Studio Code and having trouble connecting to my device. In nRF for Desktop Connect (V 4.1.2) I tried Programmer (V3.0.9) to connect to a custom board to which I can connect to using SES (using the dropdown connect to device in SES). The Programmer log shows:

16:14:29.493
Using nrf-device-lib-js version: 0.6.12
16:14:29.494
Using nrf-device-lib version: 0.15.3
16:14:29.495
Using nrfjprog DLL version: 10.19.1
16:14:29.495
Using JLink version: JLink_V7.88l
16:14:29.784
Installed JLink version does not match the provided version (V7.80c)
And I cannot see a device connected; all the option drop-down are gray.
Within Visual Studio, under devices connected I see:
When I try to flash a simple example code (UART-Bluetooth sample), Visual Studio shows:
Executing task: nRF Connect: Flash: central_uart/build (active)

Flashing build to 4294967295
/bin/sh -c west flash -d /Users/wadesmith/Documents/GitHub/HP_V5/central_uart/build --skip-rebuild --dev-id 4294967295

-- west flash: using runner nrfjprog
-- runners.nrfjprog: Flashing file: /Users/ws/Documents/GitHub/HP_V5/central_uart/build/zephyr/zephyr.hex
[error] [ Client] - Encountered error -102: Command connect_to_emu_with_snr executed for 49 milliseconds with result -102
ERROR: Unable to connect to a debugger.
[error] [ Worker] - An unknown error.
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.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
FATAL ERROR: command exited with status 33: nrfjprog --program /Users/wadesmith/Documents/GitHub/HP_V5/central_uart/build/zephyr/zephyr.hex --sectoranduicrerase --verify -f NRF52 --snr 4294967295
Here is the version of nrfjprog:

% nrfjprog --version

nrfjprog version: 10.22.1 external

JLinkARM.dll version: 7.88l

In terminal I enter the same call to nrfjprog and it produces the same error as follows:

% nrfjprog --program /Users/ws/Documents/GitHub/HP_V5/central_uart/build/zephyr/zephyr.hex --sectoranduicrerase --verify -f NRF52 --snr 4294967295

[error] [ Client] - Encountered error -102: Command connect_to_emu_with_snr executed for 47 milliseconds with result -102

ERROR: Unable to connect to a debugger.

[error] [ Worker] - An unknown error.

ERROR: JLinkARM DLL reported an error.

This is on a Mac Silicon M1 (Ventura 13.4.1); I installed the universal J-Link tool. Thoughts about what I am doing wrong? I appreciate the help. 

Parents Reply Children
  • Same trouble. Attached is the log file. Thanks

    [2023-Jul-28 09:53:45] [debug] --------------------------------------------------------------------------------
    [2023-Jul-28 09:53:45] [debug] nrfjprog --program /Users/wadesmith/Documents/GitHub/HP_V5/central_uart/build/zephyr/zephyr.hex --sectoranduicrerase --verify -f NRF52 --snr 4294967295 --log 
    [2023-Jul-28 09:53:45] [debug] nrfjprog version 10.23.0 external
    [2023-Jul-28 09:53:45] [debug] --------------------------------------------------------------------------------
    [2023-Jul-28 09:53:45] [ info] Load library at /Applications/Nordic Semiconductor/lib/libnrfjprogdll.dylib.
    [2023-Jul-28 09:53:45] [ info] Library loaded, loading member functions.
    [2023-Jul-28 09:53:45] [ info] Member functions succesfully loaded.
    [2023-Jul-28 09:53:45] [debug] [ Client] - open
    [2023-Jul-28 09:53:45] [debug] [ Client] - start
    [2023-Jul-28 09:53:45] [ info] [ Client] - stdout: Jlinkarm nRF Worker ready. Handling sequence e80d9745-43f4-4a48-bde4-cee7c3e2331c.
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - Logger sink registered in Segger backend logger
    [2023-Jul-28 09:53:45] [debug] [  JLink] - Logger sink registered in JLink logger
    [2023-Jul-28 09:53:45] [debug] [  nRF52] - open
    [2023-Jul-28 09:53:45] [debug] [  nRF52] - just_check_family
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - open_dll
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - No J-Link DLL path was provided. Attempting to auto detect.
    [2023-Jul-28 09:53:45] [warning] [SeggerBackend] - Executing using Rosetta 2. In case of unexpected errors, try executing with arch -arch arm64 nrfjprog...
    [2023-Jul-28 09:53:45] [ info] [SeggerBackend] - Load library at /Applications/SEGGER/JLink/libjlinkarm.7.88.12.dylib.
    [2023-Jul-28 09:53:45] [ info] [SeggerBackend] - Library loaded, loading member functions.
    [2023-Jul-28 09:53:45] [ info] [SeggerBackend] - Member functions succesfully loaded.
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - Set batch mode
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - dll_version
    [2023-Jul-28 09:53:45] [ info] [SeggerBackend] - Segger dll version 7.88.l loaded.
    [2023-Jul-28 09:53:45] [trace] [ Worker] - Command open executed for 20 milliseconds with result 0
    [2023-Jul-28 09:53:45] [trace] [ Client] - Command open executed for 41 milliseconds with result 0
    [2023-Jul-28 09:53:45] [debug] [ Client] - config
    [2023-Jul-28 09:53:45] [trace] [ Client] - Command config executed for 8 milliseconds with result 0
    [2023-Jul-28 09:53:45] [debug] [ Client] - enum_emu_snr
    [2023-Jul-28 09:53:45] [trace] [ Client] - Command enum_emu_con_info executed for 1 milliseconds with result 0
    [2023-Jul-28 09:53:45] [debug] [ Client] - connect_to_emu_with_snr
    [2023-Jul-28 09:53:45] [debug] [  nRF52] - config
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - enum_emu_snr
    [2023-Jul-28 09:53:45] [trace] [ Worker] - Command config executed for 8 milliseconds with result 0
    [2023-Jul-28 09:53:45] [debug] [  nRF52] - enum_emu_con_info
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - is_connected_to_emu
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - enum_emu_con_info
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - is_connected_to_emu
    [2023-Jul-28 09:53:45] [trace] [ Worker] - Command enum_emu_con_info executed for 1 milliseconds with result 0
    [2023-Jul-28 09:53:45] [debug] [  nRF52] - connect_to_emu_with_snr
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - is_connected_to_emu
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - connect_to_emu_with_snr
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - is_connected_to_emu
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - ---just_enum_emu_snr
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - ---just_get_num_emus
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - ---just_connect_to_emu_with_snr
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - ---just_connect_to_emu_without_snr
    [2023-Jul-28 09:53:45] [debug] [SeggerBackend] - Segger logging enabled.
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Hardware: V8.00
    [2023-Jul-28 09:53:45] [trace] [  JLink] - S/N: 4294967295
    [2023-Jul-28 09:53:45] [trace] [  JLink] - OEM: SEGGER
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Feature(s): RDI,FlashDL,FlashBP,JFlash,GDB
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Bootloader: (Could not read)
    [2023-Jul-28 09:53:45] [trace] [  JLink] - TELNET listener socket opened on port 19021
    [2023-Jul-28 09:53:45] [trace] [  JLink] - WEBSRV WEBSRV_Init(): Starting webserver thread(s)
    [2023-Jul-28 09:53:45] [trace] [  JLink] - WEBSRV Webserver running on local port 19080
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Looking for J-Link GUI Server exe at: /Applications/SEGGER/JLink_V788l/JLinkGUIServerExe 
    [2023-Jul-28 09:53:45] [trace] [  JLink] - Forking J-Link GUI Server: /Applications/SEGGER/JLink_V788l/JLinkGUIServerExe 
    [2023-Jul-28 09:53:46] [trace] [  JLink] - J-Link GUI Server info: "J-Link GUI server V7.88l " 
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 335.242ms returns "O.K."  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_Lock()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_ExecCommand("SetRestartOnClose = 0", ...).   
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.263ms returns 0x01  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_ExecCommand("DisableFlashDL", ...).   
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.003ms returns 0x00  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).   
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.003ms returns 0x00  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_SetHookUnsecureDialog  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_SetHookUnsecureDialog(...)
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.007ms returns 0  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_TIF_Select(JLINKARM_TIF_SWD)  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.887ms returns 0x00  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSpeedInfo()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - 4000000 Hz / n, n >= 1
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.007ms  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [debug] [SeggerBackend] - Connected emulator supports SWD speeds up to 4000kHz
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_SetSpeed(2000)  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.113ms  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSpeed()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.004ms returns 2000  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [debug] [SeggerBackend] - SWD clock set to 2000kHz
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSN()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.005ms returns -1  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSN()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.007ms returns -1  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSN()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.003ms returns -1  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSN()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.003ms returns -1  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_GetSN()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - - 0.003ms returns -1  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_HasError()  
    [2023-Jul-28 09:53:46] [trace] [  JLink] - JLINK_G

  • [2023-Jul-28 09:53:46] [trace] [ JLink] - JLINK_GetSN()
    [2023-Jul-28 09:53:46] [trace] [ JLink] - - 0.007ms returns -1

    Thank you for providing the log file. The issue arises because the debugger's serial number is set to 4294967295, which equals 0xFFFFFFFF. This corresponds to "-1" when it is interpreted as a two's complement value by the J-Link library, and negative values are treated as errors. I guess SES must be ignoring this error.

    Please contact Segger support if this is a genuine debug probe. The serial number is supposed to be set during production.

  • Thank you Vidar for figuring this out. I will check with SEGGER- I bought the probe from them.  

  • It turns out that the SEGGER probe was counterfeit; bought it on Amazon. Annoying that there are people out there stealing IP from companies. 

  • Sorry I did not close the tread; Vidar answered the question.

Related