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

nrfjprog --family nRF52 --eraseall error

 nrfjprog --family nRF52 --eraseall --log
ERROR: The --family option given with the command (or the default from
ERROR: nrfjprog.ini) does not match the device connected.


 cat .\log.log
[2021-Jul-13 16:13:46] [ info] --------------------------------------------------------------------------------
[2021-Jul-13 16:13:46] [ info] C:\Program Files (x86)\Nordic Semiconductor\nrf-command-line-tools\bin\nrfjprog.exe --family nRF52 --eraseall --log
[2021-Jul-13 16:13:46] [ info] nrfjprog version 10.10.0
[2021-Jul-13 16:13:46] [ info] --------------------------------------------------------------------------------
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - open_dll
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - Load library at C:\Program Files (x86)\Nordic Semiconductor\nrf-command-line-tools\bin\JLINKARM_NRF52_NRFJPROG.dll.
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - Library loaded, loading member functions.
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - Member functions succesfully loaded.
[2021-Jul-13 16:13:46] [debug] [Backend] - Logger callback at 0x851d80 registered in Segger backend logger.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Logger callback at 0x851d80 registered in JLink logger.
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - open
[2021-Jul-13 16:13:46] [debug] [Backend] - open_dll
[2021-Jul-13 16:13:46] [debug] [Backend] - No J-Link DLL path was provided. Attempting to auto detect.
[2021-Jul-13 16:13:46] [debug] [Backend] - Load library at C:\Program Files (x86)\SEGGER\JLink\JLinkARM.dll.
[2021-Jul-13 16:13:46] [debug] [Backend] - Library loaded, loading member functions.
[2021-Jul-13 16:13:46] [debug] [Backend] - Member functions succesfully loaded.
[2021-Jul-13 16:13:46] [debug] [Backend] - dll_version
[2021-Jul-13 16:13:46] [debug] [Backend] - Segger dll version 6.88.a loaded.
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - enum_emu_snr
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - enum_emu_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_emu
[2021-Jul-13 16:13:46] [debug] [Backend] - enum_emu_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_enum_emu_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_get_num_emus
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_emu
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - connect_to_emu_with_snr
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - connect_to_emu_with_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_emu
[2021-Jul-13 16:13:46] [debug] [Backend] - connect_to_emu_with_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_emu
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_enum_emu_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_get_num_emus
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_connect_to_emu_with_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_connect_to_emu_without_snr
[2021-Jul-13 16:13:46] [debug] [Backend] - Segger logging enabled.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Firmware: J-Link V9 compiled May  7 2021 16:26:12
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Decompressing FW timestamp took 120 us
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Hardware: V9.40
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] S/N: 59412569
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] OEM: SEGGER
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] TELNET listener socket opened on port 19021
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] WEBSRV Starting webserver
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] WEBSRV Failed to put socket into listener state (port 19080)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] WEBSRV Webserver running on local port 19081
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 16.239ms returns "O.K."
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_Lock()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_GetHWStatus(...)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.306ms returns 0
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_ExecCommand("SetRestartOnClose = 0", ...).
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.010ms returns 0x01
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_ExecCommand("DisableFlashDL", ...).
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.005ms returns 0x00
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.004ms returns 0x00
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_SetHookUnsecureDialog
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_SetHookUnsecureDialog(...)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.022ms returns 0
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_TIF_Select(JLINKARM_TIF_SWD)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.553ms returns 0x00
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_SetSpeed(2000)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.094ms
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_GetSN()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.010ms returns 59412569
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_load_core_data
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_ExecCommand("CORESIGHT_SetIndexAHBAPToUse = 0", ...).
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.005ms returns 0x00
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_ExecCommand("device = nRF52", ...).
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] XML file found at: C:\Program Files (x86)\SEGGER\JLink\JLinkDevices.xml
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] C:\Program Files (x86)\SEGGER\JLink\JLinkDevices.xml evaluated successfully.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Device "NRF52" selected.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 39.326ms returns 0x00
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [Backend] - read_debug_port_idr
[2021-Jul-13 16:13:46] [debug] [Backend] - read_debug_port_register
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_read_debug_port_register
[2021-Jul-13 16:13:46] [debug] [Backend] - coresight_configure
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_CORESIGHT_Configure()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.708ms returns 0
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_CORESIGHT_ReadAPDPReg(DP reg 0x00)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] Value=0xEBA01477
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.696ms returns 0
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - Debug probe is not connected to an NRF52 series device.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.015ms
[2021-Jul-13 16:13:46] [debug] [ nRF0x0] - close_dll
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - close
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_emu
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_IsOpen()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.011ms returns 0x01
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_Lock()
[2021-Jul-13 16:13:46] [debug] [Backend] - close
[2021-Jul-13 16:13:46] [debug] [Backend] - disconnect_from_emu
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_disconnect_from_emu
[2021-Jul-13 16:13:46] [debug] [Backend] - is_connected_to_device
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_IsConnected()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.010ms returns FALSE
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_is_debug_region_powered
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_read_debug_port_register
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_write_debug_port_register
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.521ms returns -1
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [Backend] - JLinkARM.dll reported "-1", an unknown error.
[2021-Jul-13 16:13:46] [debug] [Backend] - ---just_abort_debug_action
[2021-Jul-13 16:13:46] [debug] [Backend] - Attempting to clear any configuration errors in debug port before closing connection.
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x00, 0x0000001F)
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.507ms returns 0
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_HasError()
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] - 0.011ms
[2021-Jul-13 16:13:46] [debug] [  JLink] - [Debug   ] [JLink     ] JLINK_Close()
[2021-Jul-13 16:13:46] [debug] [Backend] - Segger Backend closed.
[2021-Jul-13 16:13:46] [debug] [nRF520x0] - nRF family DLL closed

Hello, I tried to run the following command on my nRF52832 today and it reported an error.

The operation before the error was: I enabled APPROTECT, and when my colleague used JLink to connect to it, a pop-up window asked whether to unsecure it. After he chose Yes, I could no longer use nrfjprog to successfully execute any commands.

There is a certain probability that the chip can be connected with jlink, but the connection is very unstable, about four to five times before it can be successful, other times I will occasionally remind me that the chip is secured.

I tried to burn it into the new firmware and it also reported an error:

****** Error: Failed to prepare for programming. Could not preserve target memory. Unspecified error -1

And when I use mem8 in Jlink to read some memory, all of them are just 0xFF

J-Link>connect                                                                                                          
Device "NRF52" selected.                                                                                                                                                                                                                                                                                                                                                
Connecting to target via SWD                                                                                            
InitTarget() start                                                                                                      
InitTarget() end                                                                                                        
Found SW-DP with ID 0x2BA01477                                                                                          
DPIDR: 0x2BA01477                                                                                                       
AP map detection skipped. Manually configured AP map found.                                                             
AP[0]: AHB-AP (IDR: Not set)                                                                                            
AP[0]: Core found                                                                                                       
AP[0]: AHB-AP ROM base: 0xE00FF000                                                                                      
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)                                                                
Found Cortex-M4 r0p1, Little endian.                                                                                    
FPUnit: 6 code (BP) slots and 2 literal slots                                                                           
CoreSight components:                                                                                                   
ROMTbl[0] @ E00FF000                                                                                                    
Cortex-M4 identified.                                                                                                   
J-Link>mem8 0x0 0x10                                                                                                    
Could not read memory.                                                                                                  
J-Link>mem8 0x0 0x10                                                                                                    
00000000 = FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

Related