nrfjprog --recover fails when flashing nRF52840_XXAA

Hi all,

I'm unable to flash my nRF52840_XXAA using the nRF Connect extension in VS Code. My project uses the command:

west flash -d <BUILD-DIRECTORY> --dev-id 1050304532 --recover

to mass erase the device and disable readback protection, but recovery fails. The VS Code terminal shows:

-- runners.nrfjprog: Recovering and erasing all flash memory.
Recovering device. This operation might take 30s.
[error] [ Worker] - Could not connect to CPU core. This may indicate that AP protection is enabled.
ERROR: Recover failed. Please make sure that the correct device family is given
FATAL ERROR: command exited with status 62: nrfjprog --recover -f NRF52 --snr 1050304532

The nRF Connect Desktop log reports:

INFO Recovering Application core 0%
ERROR: Batch task recover failed, [jlink] RECOVER_FAILED.

I previously powered the board mid-flash, which might have left it locked with readback protection enabled. I've also tried using J-Link Commander, but with no success.

Has anyone experienced this issue? Are there alternative recovery methods or workarounds to clear access protection?

Thanks in advance!

  • Hello,

    What version of nrfjprog are you using here? How is your DK powered? Please make sure it is powered properly. Is your DK detected properly by the PC?

    I also recommend trying the nRFUtil commands to see if the DK is responding.

    Kind Regards,

    Abhijith

  • Hi Abhijith,

    Thanks for the suggestions. Here’s my setup and what I’ve tried so far:

    I'm using nrfjprog version 10.24.2 (external) with JLinkARM.dll version 7.94i. My DK is powered directly via USB from the PC, and the power LED confirms it’s getting proper power. In Device Manager, the board shows up as a JLink CDC UART Port on COM9 and COM10, and when I run nrfjprog --ids I get the serial number 1050304532.

    I attempted to use nrfutil commands, but it appears that the device listing commands have been removed in the current version. Instead, I confirmed the board is detected using nrfjprog --ids.

    I’d appreciate any further suggestions or alternative recovery methods to clear the protection. Thanks in advance for your help!

    Best regards,
    Gabriel

  • Hello,

    Try running the eraseall command. You can also do the same using the nRF Connect Programmer app, where you will find a button for the eraseall function.

    See this blog post on AppProtect, where they explain a few steps.

    Kind Regards,

    Abhijith

Related