I had been programming custom boards with the nRF52840 DK both through nRF Connect and the Command Line tool without issues. I have shorted SB47 to provide power to the target.
At some point, when I tried programming a board I started getting the followinf error.
ERROR: JLinkARM DLL reported an error. Try again
I have extracted programming logs as that was suggested on the error message.
2019-Nov-04 17:08:20 --------------------------------------------------------------------------------
2019-Nov-04 17:08:20 nrfjprog -f NRF52 --program C:\Users\Amit\Desktop\atom_app.app_sd_bl_settings.2.0.38+004.Utility_Poles_UP_R1_Debug.hex --chiperase -c 1500 --verify --log
2019-Nov-04 17:08:20 nrfjprog version 9.8.1
2019-Nov-04 17:08:20 --------------------------------------------------------------------------------
2019-Nov-04 17:08:20 nRF_open_dll
2019-Nov-04 17:08:20 . nRF52_open_dll
2019-Nov-04 17:08:20 . . nRF52_dll_version
2019-Nov-04 17:08:20 nRF_enum_emu_snr
2019-Nov-04 17:08:20 . nRF52_enum_emu_snr
2019-Nov-04 17:08:20 . . nRF52_enum_emu_snr
2019-Nov-04 17:08:20 nRF_enum_emu_snr
2019-Nov-04 17:08:20 . nRF52_enum_emu_snr
2019-Nov-04 17:08:20 . . nRF52_enum_emu_snr
2019-Nov-04 17:08:20 nRF_connect_to_emu_with_snr
2019-Nov-04 17:08:20 . nRF52_connect_to_emu_with_snr
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu
2019-Nov-04 17:08:20 . . nRF52_enum_emu_snr
2019-Nov-04 17:08:20 . . nRF52_connect_to_emu_with_snr
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 7 2019 14:07:15
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: Hardware: V1.00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: S/N: 683242816
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: TELNET listener socket opened on port 19021
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: WEBSRV Starting webserver
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0020ms, 0028ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:020
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: WEBSRV Webserver running on local port 19080
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0023ms, 0031ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:020
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns O.K.
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0026ms, 0034ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:046
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_GetHWStatus(...)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0004ms, 0038ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: There is no generic nRF52 device in J-Link, so we select NRF52832_xxAA.
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:055
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_ExecCommand("Device = NRF52832_xxAA", ...).
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: XML file found at: C:\Program Files (x86)\SEGGER\JLink_V644g\JLinkDevices.xml
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0002ms, 0046ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:057
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: C:\Program Files (x86)\SEGGER\JLink_V644g\JLinkDevices.xml evaluated successfully.
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: Device "NRF52832_XXAA" selected.
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: Device "NRF52832_XXAA" selected.
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0117ms, 0161ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:175
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_ExecCommand("SetRestartOnClose = 0", ...).
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x01
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0001ms, 0164ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:178
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_ExecCommand("DisableFlashDL", ...).
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0001ms, 0167ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:181
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_ExecCommand("SetDbgPowerDownOnClose = 1", ...).
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x01
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0001ms, 0170ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:183
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0000ms, 0172ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:186
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_TIF_Select(JLINKARM_TIF_SWD)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: returns 0x00
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0004ms, 0177ms total)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: T331A10 000:191
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: JLINK_SetSpeed(1500)
2019-Nov-04 17:08:20 . . . nRF52_connect_to_emu_without_snr: JLink: (0002ms, 0180ms total)
2019-Nov-04 17:08:20 nRF_read_device_version
2019-Nov-04 17:08:20 . nRF52_read_device_version
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu: JLink: T331A10 000:196
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu: JLink: JLINK_IsOpen()
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu: JLink: returns 0x01
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_emu: JLink: (0002ms, 0182ms total)
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_device
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_device: JLink: T331A10 000:199
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_device: JLink: JLINK_IsConnected()
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_device: JLink: returns FALSE
2019-Nov-04 17:08:20 . . nRF52_is_connected_to_device: JLink: (0002ms, 0184ms total)
2019-Nov-04 17:08:20 . . nRF52_readback_status
2019-Nov-04 17:08:20 . . . nRF52_is_ctrl_ap_available
2019-Nov-04 17:08:20 . . . . nRF52_read_access_port_register
2019-Nov-04 17:08:20 . . . . . nRF52_coresight_configure
2019-Nov-04 17:08:20 . . . . . nRF52_coresight_configure: JLink: T331A10 000:205
2019-Nov-04 17:08:20 . . . . . nRF52_coresight_configure: JLink: JLINK_CORESIGHT_Configure()
2019-Nov-04 17:08:21 . . . . . nRF52_coresight_configure: JLink: returns 0
2019-Nov-04 17:08:21 . . . . . nRF52_coresight_configure: JLink: (0106ms, 0291ms total)
2019-Nov-04 17:08:21 . . . . . nRF52_power_debug_and_system_regions
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register: JLink: T331A10 000:319
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register: JLink: JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register: JLink: returns -1
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register: JLink: (0009ms, 0303ms total)
2019-Nov-04 17:08:21 . . . . . . nRF52_write_debug_port_register: JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -1.
2019-Nov-04 17:08:21 . . . . . nRF52_power_debug_and_system_regions: JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -102.
2019-Nov-04 17:08:21 nRF_close_dll
2019-Nov-04 17:08:21 . nRF52_close_dll
2019-Nov-04 17:08:21 . . nRF52_is_connected_to_emu
2019-Nov-04 17:08:21 . . nRF52_is_connected_to_emu: JLink: T331A10 000:337
2019-Nov-04 17:08:21 . . nRF52_is_connected_to_emu: JLink: JLINK_IsOpen()
2019-Nov-04 17:08:21 . . nRF52_is_connected_to_emu: JLink: returns 0x01
2019-Nov-04 17:08:21 . . nRF52_is_connected_to_emu: JLink: (0003ms, 0308ms total)
2019-Nov-04 17:08:21 . . nRF52_disconnect_from_emu
2019-Nov-04 17:08:21 . . . nRF52_is_connected_to_device
2019-Nov-04 17:08:21 . . . nRF52_is_connected_to_device: JLink: T331A10 000:343
2019-Nov-04 17:08:21 . . . nRF52_is_connected_to_device: JLink: JLINK_IsConnected()
2019-Nov-04 17:08:21 . . . nRF52_is_connected_to_device: JLink: returns FALSE
2019-Nov-04 17:08:21 . . . nRF52_is_connected_to_device: JLink: (0003ms, 0312ms total)
2019-Nov-04 17:08:21 . . . nRF52_unpower_debug_and_system_regions
2019-Nov-04 17:08:21 . . nRF52_disconnect_from_emu: JLink: T331A10 000:360
2019-Nov-04 17:08:21 . . nRF52_disconnect_from_emu: JLink: JLINK_Close()