I am working with the wisblock 4631 from rak, that contains an NRF52840. I am working with the Zephyr infrastructure and uploading code via the Nordic extension for VS Code. To upload code, I was using the nRF52 DK through SWD. I was able to flash code multiple times without any problem using the command west flash --runner nrfjprog. Then, to erase all memory before flashing new code, I tried the command west flash --runner nrfjprog --erase, but it gave me an error. Now, the same error appears every time I try to upload new code. The error is the following:
[error] [ Client] - Encountered error -102: Command read_device_info executed for 139 milliseconds with result -102[error] [ Client] - Encountered error -102: Command read_memory_descriptors executed for 46 milliseconds with result -102Failed to read device memories.[error] [ Worker] - An unknown error.[error] [ Worker] - An unknown error.ERROR: JLinkARM DLL reported an error. Try again. If error conditionERROR: persists, run the same command again with argument --log, contact NordicERROR: 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 ‘C:\Users\royal\Desktop\IT\0_Meu_Zephyr\sensor-box-zephyr\RAK4631\build\merged.hex’ --sectoranduicrerase --verify -f NRF52 --snr 682565660
I tried several solutions, but none worked. When I try to connect to the board via J-Link, I get:
Connecting to target via SWDInitTarget() startInitTarget() end - Took 4.97msFound SW-DP with ID 0x2BA01477Failed to power up DAPConnect fallback: Reset via Reset pin & Connect.InitTarget() startInitTarget() end - Took 3.52msFound SW-DP with ID 0x2BA01477Failed to power up DAPCannot connect to target.
I suspected the issue was related to DAP or APPROTECT, so I followed this thread:
https://devzone.nordicsemi.com/f/nordic-q-a/12484/approtect-and-dap/47301
But when I tried those commands in J-Link Commander, I got the following output:
SEGGER J-Link Commander V7.88j (Compiled Jun 28 2023 13:40:51)DLL version V7.88j, compiled Jun 28 2023 13:39:15
Connecting to J-Link via USB...O.K.Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jun 25 2024 17:06:37Hardware version: V1.00J-Link uptime (since boot): 0d 00h 00m 46sS/N: 682565660License(s): RDI, FlashBP, FlashDL, JFlash, GDBUSB speed mode: High speed (480 MBit/s)VTref=3.300V
Type "connect" to establish a target connection, '?' for helpJ-Link>SWDSelectSelect SWD by sending SWD switching sequence.J-Link>SWDWriteDP 1 0x50000000Write DP register 1 = 0x50000000 ***ERRORJ-Link>SWDWriteDP 2 0x01000000Write DP register 2 = 0x01000000 ***ERRORJ-Link>Unknown command. '?' for help.J-Link>SWDWriteAP 1 0x00000001Write AP register 1 = 0x00000001 ***ERRORJ-Link>Unknown command. '?' for help.J-Link>sleep 500Sleep(500)J-Link>Unknown command. '?' for help.J-Link>SWDReadAP 3Read AP register 3 = 0x00000000J-Link>Unknown command. '?' for help.J-Link>SWDReadAP 3Read AP register 3 = ERROR
At this point, I am unable to flash or read anything from the chip.