Failed to flash to WISBLOCK4631

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 -102
Failed to read device memories.
[error] [ Worker] - An unknown error.
[error] [ Worker] - An unknown error.
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: 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 SWD
InitTarget() start
InitTarget() end - Took 4.97ms
Found SW-DP with ID 0x2BA01477
Failed to power up DAP
Connect fallback: Reset via Reset pin & Connect.
InitTarget() start
InitTarget() end - Took 3.52ms
Found SW-DP with ID 0x2BA01477
Failed to power up DAP
Cannot 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:37
Hardware version: V1.00
J-Link uptime (since boot): 0d 00h 00m 46s
S/N: 682565660
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
USB speed mode: High speed (480 MBit/s)
VTref=3.300V


Type "connect" to establish a target connection, '?' for help
J-Link>SWDSelect
Select SWD by sending SWD switching sequence.
J-Link>SWDWriteDP 1 0x50000000
Write DP register 1 = 0x50000000 ***ERROR
J-Link>SWDWriteDP 2 0x01000000
Write DP register 2 = 0x01000000 ***ERROR
J-Link>
Unknown command. '?' for help.
J-Link>SWDWriteAP 1 0x00000001
Write AP register 1 = 0x00000001 ***ERROR
J-Link>
Unknown command. '?' for help.
J-Link>sleep 500
Sleep(500)
J-Link>
Unknown command. '?' for help.
J-Link>SWDReadAP 3
Read AP register 3 = 0x00000000
J-Link>
Unknown command. '?' for help.
J-Link>SWDReadAP 3
Read AP register 3 = ERROR

At this point, I am unable to flash or read anything from the chip.

Parents
  • Hi,

    Can you describe your current setup for flashing and reading?

    Which versions of the tools do you use?

    Can you try to use Programmer application, west flash and nrfutil for flashing? What is the result?

    Best regards,
    Dejan

  • I am using an nrf52dk hocked up to the PC via USB. Then, via SWD I am connecting the nrf52dk to the rak4631 (VTG<->3.3V, SWDIO<->SWDIO, SWDCLK<->SWDCLK, RESET<->RESET, GND<->GND). I am using the nrf connect extension for vscode, version 3.0.2 and west with nrfjprog to flash.  

    With Programmer v4.5.0:

    16:43:48.006
    Initialising the bundled nrfutil device
    16:43:49.579
    Using the bundled core version for nrfutil device: 8.1.1
    16:43:50.119
    Using nrfutil-device version: 2.6.4
    16:43:50.119
    Using nrf-device-lib version: 0.17.35
    16:43:50.119
    Using nrfjprog DLL version: 10.24.2
    16:43:50.119
    Using JLink version: JLink_V7.94i
    16:43:50.484
    Getting serial port options from the persistent store for 000682565660.pc-nrfconnect-programmer
    16:43:50.484
    Getting serial port options from the persistent store for 000000000.pc-nrfconnect-programmer
    16:44:10.272
    Selecting device with the serial number 000682565660
    16:44:11.993
    Error: Failed with exit code 1. Failed to device info one or more devices: * 682565660: [Probe] Device error: Failed to write DebugPort register 1: Unknown Error in J-Link DLL (error code =-1), code: Generic. Message: Operation device-info failed, [Probe] Device error: Failed to write DebugPort register 1: Unknown Error in J-Link DLL (error code =-1).
    16:44:11.994
    Selected device with the serial number 000682565660
    16:44:11.994
    Using nrfutil device to communicate with target via JLink
    16:44:13.493
    Reading readback protection status for Application core
    16:44:13.494
    Reading readback protection status for Application core 0%
    16:44:13.584
    Failed "reading readback protection status for application core". Error: code: 9, description: Nrfjlink, message: Batch task protection-get failed, [jlink] INVALID_OPERATION
    16:44:13.797
    Error: Failed with exit code 1. One or more batch tasks failed: - [jlink] INVALID_OPERATION, code: Nrfjlink. Message: Batch task protection-get failed, [jlink] INVALID_OPERATION.
    16:44:13.797
    Error: Failed with exit code 1. One or more batch tasks failed: - [jlink] INVALID_OPERATION, code: Nrfjlink. Message: Batch task protection-get failed, [jlink] INVALID_OPERATION.
    With west flash --runner nrfjprog:
    PS C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\hello_world> west flash --runner nrfjprog
    -- west flash: rebuilding
    ninja: no work to do.
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: reset after flashing requested
    Using board 682565660
    -- runners.nrfjprog: Flashing file: C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\merged.hex
    [ #################### ] 0.938s | Erase file - Done erasing
    [error] [ Client] - Encountered error -102: Command program_file executed for 402 milliseconds with result -102
    [error] [ nRF52] - The write access failed, but no cause could be determined.
    [error] [ nRF52] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue.
    [error] [ nRF52] - Failed while performing 'Write' operation on target address 0x00000000.
    -102: An unknown error.
    [error] [ nRF52] - Failed while reading device information.
    [error] [ Worker] - An unknown error.
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: 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\5_Testes\hello_world\build\merged.hex' --sectoranduicrerase --verify -f NRF52 --snr 682565660
    With nrfutil (west flash that uses nrfutil):
    -- west flash: rebuilding
    ninja: no work to do.
    -- west flash: using runner nrfutil
    -- runners.nrfutil: reset after flashing requested
    Using board 000682565660
    -- runners.nrfutil: Flashing file: C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\merged.hex
    -- runners.nrfutil: Upload image.
    Error: One or more batch tasks failed:
    - [jlink] JLINKARM_DLL_ERROR, code: Nrfjlink

    FATAL ERROR: command exited with status 9: nrfutil --json device x-execute-batch --batch-path 'C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\generated_nrfutil_batch.json' --serial-number 682565660
Reply
  • I am using an nrf52dk hocked up to the PC via USB. Then, via SWD I am connecting the nrf52dk to the rak4631 (VTG<->3.3V, SWDIO<->SWDIO, SWDCLK<->SWDCLK, RESET<->RESET, GND<->GND). I am using the nrf connect extension for vscode, version 3.0.2 and west with nrfjprog to flash.  

    With Programmer v4.5.0:

    16:43:48.006
    Initialising the bundled nrfutil device
    16:43:49.579
    Using the bundled core version for nrfutil device: 8.1.1
    16:43:50.119
    Using nrfutil-device version: 2.6.4
    16:43:50.119
    Using nrf-device-lib version: 0.17.35
    16:43:50.119
    Using nrfjprog DLL version: 10.24.2
    16:43:50.119
    Using JLink version: JLink_V7.94i
    16:43:50.484
    Getting serial port options from the persistent store for 000682565660.pc-nrfconnect-programmer
    16:43:50.484
    Getting serial port options from the persistent store for 000000000.pc-nrfconnect-programmer
    16:44:10.272
    Selecting device with the serial number 000682565660
    16:44:11.993
    Error: Failed with exit code 1. Failed to device info one or more devices: * 682565660: [Probe] Device error: Failed to write DebugPort register 1: Unknown Error in J-Link DLL (error code =-1), code: Generic. Message: Operation device-info failed, [Probe] Device error: Failed to write DebugPort register 1: Unknown Error in J-Link DLL (error code =-1).
    16:44:11.994
    Selected device with the serial number 000682565660
    16:44:11.994
    Using nrfutil device to communicate with target via JLink
    16:44:13.493
    Reading readback protection status for Application core
    16:44:13.494
    Reading readback protection status for Application core 0%
    16:44:13.584
    Failed "reading readback protection status for application core". Error: code: 9, description: Nrfjlink, message: Batch task protection-get failed, [jlink] INVALID_OPERATION
    16:44:13.797
    Error: Failed with exit code 1. One or more batch tasks failed: - [jlink] INVALID_OPERATION, code: Nrfjlink. Message: Batch task protection-get failed, [jlink] INVALID_OPERATION.
    16:44:13.797
    Error: Failed with exit code 1. One or more batch tasks failed: - [jlink] INVALID_OPERATION, code: Nrfjlink. Message: Batch task protection-get failed, [jlink] INVALID_OPERATION.
    With west flash --runner nrfjprog:
    PS C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\hello_world> west flash --runner nrfjprog
    -- west flash: rebuilding
    ninja: no work to do.
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: reset after flashing requested
    Using board 682565660
    -- runners.nrfjprog: Flashing file: C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\merged.hex
    [ #################### ] 0.938s | Erase file - Done erasing
    [error] [ Client] - Encountered error -102: Command program_file executed for 402 milliseconds with result -102
    [error] [ nRF52] - The write access failed, but no cause could be determined.
    [error] [ nRF52] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue.
    [error] [ nRF52] - Failed while performing 'Write' operation on target address 0x00000000.
    -102: An unknown error.
    [error] [ nRF52] - Failed while reading device information.
    [error] [ Worker] - An unknown error.
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: 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\5_Testes\hello_world\build\merged.hex' --sectoranduicrerase --verify -f NRF52 --snr 682565660
    With nrfutil (west flash that uses nrfutil):
    -- west flash: rebuilding
    ninja: no work to do.
    -- west flash: using runner nrfutil
    -- runners.nrfutil: reset after flashing requested
    Using board 000682565660
    -- runners.nrfutil: Flashing file: C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\merged.hex
    -- runners.nrfutil: Upload image.
    Error: One or more batch tasks failed:
    - [jlink] JLINKARM_DLL_ERROR, code: Nrfjlink

    FATAL ERROR: command exited with status 9: nrfutil --json device x-execute-batch --batch-path 'C:\Users\royal\Desktop\IT\5_Testes\hello_world\build\generated_nrfutil_batch.json' --serial-number 682565660
Children
Related