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

Upload on nrf52_dk Cannot connect to target

Hello,

I am trying the nRF52 DK but I am struggling to make an upload on it.
My first goal is just to make the led1 blink.
How could I troubleshoot the upload.


Each time I tried an upload I got the following message :

JLink.exe -device nRF52832_xxAA -speed 4000 -if swd -autoconnect 1 -NoGui 1 -CommanderScript "C:\Users\clement.deligeon\Documents\PlatformIO\Projects\arduino-tutorial\.pio\build\nrf52_dk\upload.jlink"
	SEGGER J-Link Commander V6.88b (Compiled Nov 27 2020 15:45:43)
	DLL version V6.88b, compiled Nov 27 2020 15:44:11


	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 OB-SAM3U128-V2-NordicSemi compiled Mar 17 2020 14:43:00
	Hardware version: V1.00
	S/N: 682973040
	License(s): RDI, FlashBP, FlashDL, JFlash, GDB
	VTref=3.300V
	Target connection not established yet but required for command.
	Device "NRF52832_XXAA" selected.


	Connecting to target via SWD
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	Cannot connect to target.

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


	Connecting to target via SWD
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	Cannot connect to target.

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


	Connecting to target via SWD
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	InitTarget() start
	InitTarget() end
	Cannot connect to target.


	Script processing completed.

During upload the led is blinking so the cable looks okay to me.
I was thinking that the issue could be bootloader missing because the card was used before by someone else.
So I don't know its current state.

Any idea how I could troubleshot the board ?

Also, while doing the basic test by following get started Irealized that step 5 wasn't working the button doesn't change which led is pulsating because led 1 to 4 are off.
 www.nordicsemi.com/.../Getting-Started
 
 Jlink is well detected.


I am using platformio IDE and I followed their tutorial : docs.platformio.org/.../arduino_debugging_unit_testing.html

Edit 04/05/2021
I try using Segger embedded following this tutorial : https://www.youtube.com/watch?v=YZouRE_Ol8g&t=148s


I get the same error than with platformio. Capture below :

  • I try to use nRFprogrammer instead of platformio and I got a new error.
    My error being :


    ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    My complete log :

    2021-05-03T13:36:26.901Z INFO Application data folder: C:\Users\username\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    2021-05-03T13:36:27.038Z DEBUG App pc-nrfconnect-programmer v1.4.8 official
    2021-05-03T13:36:27.039Z DEBUG App path: C:\Users\username\.nrfconnect-apps\node_modules\pc-nrfconnect-programmer
    2021-05-03T13:36:27.039Z DEBUG nRFConnect 3.6.1 is supported by the app (^3.6.0)
    2021-05-03T13:36:27.039Z DEBUG nRFConnect path: C:\Users\username\AppData\Local\Programs\nrfconnect\resources\app.asar
    2021-05-03T13:36:27.039Z DEBUG HomeDir: C:\Users\username
    2021-05-03T13:36:27.039Z DEBUG TmpDir: C:\Users\CLEMEN~1.DEL\AppData\Local\Temp
    2021-05-03T13:36:27.053Z INFO Using nrfjprog library 10.12.1, pc-nrfjprog-js 1.7.6
    2021-05-03T13:36:30.100Z INFO Using nrfjprog to communicate with target
    2021-05-03T13:36:30.593Z ERROR Could not fetch memory size of target devkit: Error: Error occured when get library info. Errorcode: CouldNotOpenDevice (0x4)
    Lowlevel error: JLINKARM_DLL_ERROR (ffffff9a)

    There was a solution proposed here : devzone.nordicsemi.com/.../could-not-fetch-memory-size-of-target-devkit-error-error-occured-when-get-library-info-errorcode-couldnotopendevice-0x4-lowlevel-error-unknown-value-ffffff5e

    Full log after trying recovery with nrfjprog --recover which has failed  :/

    [2021-May-03 15:51:07] [ info] --------------------------------------------------------------------------------
    [2021-May-03 15:51:07] [ info] nrfjprog --recover --log 
    [2021-May-03 15:51:07] [ info] nrfjprog version 10.12.1 
    [2021-May-03 15:51:07] [ info] --------------------------------------------------------------------------------
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - open_dll
    [2021-May-03 15:51:07] [ info] [ nRF0x0] - Load library at C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\JLINKARM_UNKNOWN_NRFJPROG.dll.
    [2021-May-03 15:51:07] [ info] [ nRF0x0] - Library loaded, loading member functions.
    [2021-May-03 15:51:07] [ info] [ nRF0x0] - Member functions succesfully loaded.
    [2021-May-03 15:51:07] [ info] [Backend] - Logger callback at 0x7ff6585c56f0 registered in Segger backend logger.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Logger callback at 0x7ff6585c56f0 registered in JLink logger.
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_open_dll_tagged_callback
    [2021-May-03 15:51:07] [debug] [Backend] - open_dll
    [2021-May-03 15:51:07] [ info] [Backend] - No J-Link DLL path was provided. Attempting to auto detect.
    [2021-May-03 15:51:07] [ info] [Backend] - Load library at C:\Program Files (x86)\SEGGER\JLink\JLink_x64.dll.
    [2021-May-03 15:51:07] [ info] [Backend] - Library loaded, loading member functions.
    [2021-May-03 15:51:07] [ info] [Backend] - Member functions succesfully loaded.
    [2021-May-03 15:51:07] [debug] [Backend] - dll_version
    [2021-May-03 15:51:07] [ info] [Backend] - Segger dll version 7.0.a loaded.
    [2021-May-03 15:51:07] [debug] [Backend] - set_core_data
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - enum_emu_snr
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_enum_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - enum_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_enum_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_get_num_emus
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - connect_to_emu_with_snr
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_connect_to_emu_with_snr
    [2021-May-03 15:51:07] [debug] [Backend] - connect_to_emu_with_snr
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_emu
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_enum_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_get_num_emus
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_connect_to_emu_with_snr
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_connect_to_emu_without_snr
    [2021-May-03 15:51:07] [ info] [Backend] - Segger logging enabled.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Hardware: V1.00
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] S/N: 682973040
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] OEM: SEGGER
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] TELNET listener socket opened on port 19021
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] WEBSRV Starting webserver
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] WEBSRV Webserver running on local port 19080
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 4.614ms returns "O.K."  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_GetHWStatus(...)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.153ms returns 0  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("SetRestartOnClose = 0", ...).   
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.005ms returns 0x01  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("DisableFlashDL", ...).   
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.003ms returns 0x00  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).   
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 0x00  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetHookUnsecureDialog  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetHookUnsecureDialog(...)
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.014ms returns 0  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_TIF_Select(JLINKARM_TIF_SWD)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.475ms returns 0x00  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetSpeed(2000)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.082ms  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_GetSN()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 682973040  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_load_core_data
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("CORESIGHT_SetIndexAHBAPToUse = 0", ...).   
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.003ms returns 0x00  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("device = Cortex-M4", ...).   
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] XML file found at: C:\Program Files (x86)\SEGGER\JLink\JLinkDevices.xml 
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] C:\Program Files (x86)\SEGGER\JLink\JLinkDevices.xml evaluated successfully. 
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Device "CORTEX-M4" selected.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] Device "CORTEX-M4" selected.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 32.085ms returns 0x00  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - read_connected_emu_snr
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_read_connected_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - read_connected_emu_snr
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_emu
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 0x01  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - read_device_family
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_read_device_family
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_emu
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.010ms returns 0x01  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Lock()  
    [2021-May-03 15:51:07] [debug] [Backend] - read_debug_port_idr
    [2021-May-03 15:51:07] [debug] [Backend] - read_debug_port_register
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_read_debug_port_register
    [2021-May-03 15:51:07] [debug] [Backend] - coresight_configure
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_Configure()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 101.285ms returns 0  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_select_debug_port_register
    [2021-May-03 15:51:07] [debug] [Backend] - Select AP 255, DP Bank 0, AP Bank 255
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 1.092ms returns -1  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [Backend] - JLinkARM.dll reported "-1", an unknown error.
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_abort_debug_action
    [2021-May-03 15:51:07] [ info] [Backend] - Attempting to clear any configuration errors in debug port before closing connection. 
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x00, 0x0000001F)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.927ms returns -1  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [Backend] - JLinkARM.dll reported "-1", an unknown error.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.016ms  
    [2021-May-03 15:51:07] [debug] [ nRF0x0] - close_dll
    [2021-May-03 15:51:07] [debug] [nRFUnknown] - Just_close_dll
    [2021-May-03 15:51:07] [debug] [Backend] - close
    [2021-May-03 15:51:07] [debug] [Backend] - disconnect_from_emu
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_emu
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.005ms returns 0x01  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_disconnect_from_emu
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_device
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsConnected()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.005ms returns FALSE  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_is_debug_region_powered
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_read_debug_port_register
    [2021-May-03 15:51:07] [debug] [Backend] - is_connected_to_emu
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.014ms returns 0x01  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Lock()  
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_select_debug_port_register
    [2021-May-03 15:51:07] [debug] [Backend] - Select AP 255, DP Bank 0, AP Bank 255
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.967ms returns -1  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [Backend] - JLinkARM.dll reported "-1", an unknown error.
    [2021-May-03 15:51:07] [debug] [Backend] - ---just_abort_debug_action
    [2021-May-03 15:51:07] [ info] [Backend] - Attempting to clear any configuration errors in debug port before closing connection. 
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x00, 0x0000001F)  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.966ms returns -1  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
    [2021-May-03 15:51:07] [ info] [Backend] - JLinkARM.dll reported "-1", an unknown error.
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] - 0.023ms  
    [2021-May-03 15:51:07] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Close()  
    [2021-May-03 15:51:07] [debug] [Backend] - Segger Backend closed.
    

  • Hi,

    It seems like the onboard debugger is not able to communicate with the nRF. Is this a new DK, a DK you use it successfully before or did you "inherit" a DK from someone else? If the latter, could it be that the SB9 solder bridge has been cut so that the nRF is not powered? If so, you need to put a jumper on the nRF current measurement port.

  • It seems like I solved the issue by putting a cable like the picture below to short circuit nrf measurement.
    Someone used the board before me and didn't told me that the cable was needed.
     

    Thanks for your help Einar

    As you said we can see on the picture that SB9 has been cut. It didn't check it.
    Any idea why SB9 would be cut ?

    I found answer to my own question, the SB9 has been cut to do power measurement.

Related