Unable to flash nRF52840 custom board

Hi,

I am experiencing issues in flashing nRF52840 on a custom board I have. I have 10 boards, and only 2 work. The rest of 8 seems to have the exact same issue. At this point, I've gone through checked and re-checked all of the schematics, gerbers, assembly of the boards - they all seem identical. Yet I have 2 boards that work fine. 

I am using Segger J-Link Plus debugger and here is the SDK and nrfjprog versions:

Here is the breakdown of what I am seeing. When I try to flash using VSCode + nRF Connect SDK extension, I see this message:

As a side note, it seems impossible to add the "--log" to the west command line as I get another failure.

Instead of flashing, I just want to read some memory from the device. By searching the Nordic forums I found a post about checking if the device is constant reset and clear it (link). So I ran that command line on a bad board and I get same failure.

On a good board, everything works fine.

Here is the log output of the "memrd" command line from a board that does not work.

 

[2023-Jan-26 17:36:56] [ info] --------------------------------------------------------------------------------
[2023-Jan-26 17:36:56] [ info] C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\nrfjprog.exe --memrd 0x10001200 --w 32 --n 8 --log . --family NRF52 
[2023-Jan-26 17:36:56] [ info] nrfjprog version 10.12.1 
[2023-Jan-26 17:36:56] [ info] --------------------------------------------------------------------------------
[2023-Jan-26 17:36:56] [debug] [ nRF0x0] - open_dll
[2023-Jan-26 17:36:56] [ info] [ nRF0x0] - Load library at C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\JLINKARM_NRF52_NRFJPROG.dll.
[2023-Jan-26 17:36:56] [ info] [ nRF0x0] - Library loaded, loading member functions.
[2023-Jan-26 17:36:56] [ info] [ nRF0x0] - Member functions succesfully loaded.
[2023-Jan-26 17:36:56] [ info] [Backend] - Logger callback at 0x7ff7a1ac56f0 registered in Segger backend logger.
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Logger callback at 0x7ff7a1ac56f0 registered in JLink logger.
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - open
[2023-Jan-26 17:36:56] [debug] [Backend] - open_dll
[2023-Jan-26 17:36:56] [ info] [Backend] - No J-Link DLL path was provided. Attempting to auto detect.
[2023-Jan-26 17:36:56] [ info] [Backend] - Load library at C:\Program Files\SEGGER\JLink\JLink_x64.dll.
[2023-Jan-26 17:36:56] [ info] [Backend] - Library loaded, loading member functions.
[2023-Jan-26 17:36:56] [ info] [Backend] - Member functions succesfully loaded.
[2023-Jan-26 17:36:56] [debug] [Backend] - dll_version
[2023-Jan-26 17:36:56] [ info] [Backend] - Segger dll version 7.84.a loaded.
[2023-Jan-26 17:36:56] [debug] [ nRF0x0] - enum_emu_snr
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - enum_emu_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [debug] [Backend] - enum_emu_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_enum_emu_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_get_num_emus
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [debug] [ nRF0x0] - connect_to_emu_with_snr
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - connect_to_emu_with_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [debug] [Backend] - connect_to_emu_with_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_enum_emu_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_get_num_emus
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_connect_to_emu_with_snr
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_connect_to_emu_without_snr
[2023-Jan-26 17:36:56] [ info] [Backend] - Segger logging enabled.
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Firmware: J-Link V11 compiled Dec 14 2022 09:09:01
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Firmware: J-Link V11 compiled Dec 14 2022 09:09:01
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Hardware: V11.00
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] S/N: 601008027
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] OEM: SEGGER
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] USB speed mode: High speed (480 MBit/s)
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] TELNET listener socket opened on port 19021
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] WEBSRV WEBSRV_Init(): Starting webserver thread(s)
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] WEBSRV Webserver running on local port 19080
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 65.390ms returns "O.K."  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Lock()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_GetHWStatus(...)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.325ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("SetRestartOnClose = 0", ...).   
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.005ms returns 0x01  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("DisableFlashDL", ...).   
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.004ms returns 0x00  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).   
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.004ms returns 0x00  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetHookUnsecureDialog  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetHookUnsecureDialog(...)
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.016ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_TIF_Select(JLINKARM_TIF_SWD)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 3.500ms returns 0x00  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_SetSpeed(2000)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.947ms  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_GetSN()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 601008027  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_load_core_data
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("CORESIGHT_SetIndexAHBAPToUse = 0", ...).   
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.005ms returns 0x00  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_ExecCommand("device = nRF52", ...).   
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Device "NRF52" selected.
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Device "NRF52" selected.
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 10.860ms returns 0x00  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - read_debug_port_idr
[2023-Jan-26 17:36:56] [debug] [Backend] - read_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_read_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - coresight_configure
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_Configure()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 1.105ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_select_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - Select AP 255, DP Bank 0, AP Bank 255
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.531ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_ReadAPDPReg(DP reg 0x00)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Value=0x2BA01477
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.850ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.008ms  
[2023-Jan-26 17:36:56] [debug] [ nRF0x0] - read_device_version
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - read_device_info
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 0x01  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Lock()  
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - Just_read_device_version
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - Just_readback_status
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - Just_is_ctrl_ap_available
[2023-Jan-26 17:36:56] [debug] [Backend] - read_access_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_read_access_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_is_debug_region_powered
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_read_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_select_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - Select AP 255, DP Bank 0, AP Bank 255
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.736ms returns -1  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [Backend] - JLinkARM.dll reported "-1", an unknown error.
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_abort_debug_action
[2023-Jan-26 17:36:56] [ info] [Backend] - Attempting to clear any configuration errors in debug port before closing connection. 
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x00, 0x0000001F)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.964ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.011ms  
[2023-Jan-26 17:36:56] [debug] [ nRF0x0] - close_dll
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - close
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_emu
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsOpen()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.006ms returns 0x01  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Lock()  
[2023-Jan-26 17:36:56] [debug] [Backend] - close
[2023-Jan-26 17:36:56] [debug] [Backend] - disconnect_from_emu
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_disconnect_from_emu
[2023-Jan-26 17:36:56] [debug] [Backend] - is_connected_to_device
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_IsConnected()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.007ms returns FALSE  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_is_debug_region_powered
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_read_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_select_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - Select AP 255, DP Bank 0, AP Bank 255
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.619ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_ReadAPDPReg(DP reg 0x01)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Value=0xF0000000
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.916ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - unpower_debug_and_system_regions
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_write_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_select_debug_port_register
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x01, 0x00000000)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 1.034ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_is_debug_region_powered
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_read_debug_port_register
[2023-Jan-26 17:36:56] [debug] [Backend] - ---just_select_debug_port_register
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_CORESIGHT_ReadAPDPReg(DP reg 0x01)  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] Value=0x00000000
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.684ms returns 0  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_HasError()  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] - 0.007ms  
[2023-Jan-26 17:36:56] [ info] [  JLink] - [Info    ] [JLink     ] JLINK_Close()  
[2023-Jan-26 17:36:56] [debug] [Backend] - Segger Backend closed.
[2023-Jan-26 17:36:56] [debug] [nRF520x0] - nRF family DLL closed

I've also tried to connect using J-Link Commander with no luck.

I am lost, and would like to avoid having 8 out of 10 boards dead. Any advice would be greatly appreciated.

  • Hi

    The error you're seeing is the JLink DLL reporting an error (from the nrfjprog return codes). Usually, the recommended thing to do is to just try again, but I guess that's not working for you. Have you tried using different USB cables, USB ports/hubs to your computer, or a different computer entirely? Do you see the JLink drive under your file explorer when attaching the device via USB?

    It could also be the nRF52 custom boards not responding to the debugger, pointing to something being wrong in the HW, and this is (from experience) the most common reason that some custom boards don't respond. Do you mind uploading your schematics and gerber files (as well as perhaps a high resolution image of the physical board) here so we can do a review on our end? I can set the case to Private mode so only yourself and Nordic engineers will be able to see the contents. A normal issue is that the DCDC components aren't mounted, and the device has been flashed with SW that enables the DCDC, this will put it in a bad state that is hard to recover from unfortunately. 

    It's also common that the pads on the nRF52840 itself aren't soldered properly, so it either isn't powered correctly or has some connection issues. Since 2 of the boards work that does indicate that the schematics/layout is correct, but that there are issues with the assembly procedure...

    Best regards,

    Simon

Related