I have an nRF52 DK board marked as: PCA10040 - 3.0.0 - 2022.12 - 1050359287
I am using a Debian 11 OS
I am using SDK version nRF5_SDK_17.1.0_ddde560 and ncs toolchain v2.3.0
By mistake, using VSCODE I programmed the nRF52 DK board as it were an nRF52840dk board.
I was trying the ncs/v2.3.0/zephyr/samples/basic/blinky_pwm application.
The debugger started and immediately stopped with an exception.
After that, and after correcting the board mistake when I try to debug again the application in VSCODE I always get the following output:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Executing task: nRF Connect: Flash: blinky_pwm/build (active)
Flashing build to 1050359287
west flash -d /home/ciro/Programming/Freelancer/Coran21/nRF_Connect_Dev/Tests/blinky_pwm/build --skip-rebuild -r nrfjprog --dev-id 1050359287
-- west flash: using runner nrfjprog
-- runners.nrfjprog: Flashing file: /home/ciro/Programming/Freelancer/Coran21/nRF_Connect_Dev/Tests/blinky_pwm/build/zephyr/zephyr.hex
[error] [ nRF52] - Access protection is enabled, can't read device version.
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
ERROR: runners.nrfjprog: Flashing failed because the target must be recovered.
To fix, run "west flash --recover" instead.
Note: this will recover and erase all flash memory prior to reflashing.
FATAL ERROR: command exited with status 16: nrfjprog --program /home/ciro/Programming/Freelancer/Coran21/nRF_Connect_Dev/Tests/blinky_pwm/build/zephyr/zephyr.hex --sectoranduicrerase --verify -f NRF52 --snr 1050359287
* The terminal process terminated with exit code: 16.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Then it asks if I wish to recover the device and if I say "Yes" I get the following output:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Executing task: nRF Connect: Flash: blinky_pwm/build (active)
Flashing build to 1050359287
west flash -d /home/ciro/Programming/Freelancer/Coran21/nRF_Connect_Dev/Tests/blinky_pwm/build --skip-rebuild -r nrfjprog --dev-id 1050359287 --recover
-- west flash: using runner nrfjprog
-- runners.nrfjprog: Recovering and erasing all flash memory.
Recovering device. This operation might take 30s.
[error] [ nRF52] - Access protection is enabled, can't read device version.
ERROR: Recover failed. Please make sure that the correct device family is given
ERROR: and try again.
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 62: nrfjprog --recover -f NRF52 --snr 1050359287
* The terminal process terminated with exit code: 62.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If I use the programmer utility the device appears as "protected" and if I click "Erase all"
I get the following log:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
09:20:34.115 Recovering NRFDL_DEVICE_CORE_APPLICATION core
09:21:35.403 Failed to recover NRFDL_DEVICE_CORE_APPLICATION core: async task failure for id: 1680160834117779 msg: [jlink] RECOVER_FAILED (Origin: "Error when running operation: recover")
09:21:35.412 Device recovery completed
09:21:35.419 Using @nordicsemiconductor/nrf-device-lib-js to communicate with target via JLink
09:21:35.420 JLink OB firmware version J-Link OB-nRF5340-NordicSemi compiled Nov 7 2022 16:22:01
09:21:35.421 Device family NRF52_FAMILY
09:21:35.423 Device version NRF51xxx_xxAA_REV1
09:21:35.425 Board version PCA10040
09:21:35.427 Loading readback protection status for Application core
09:21:36.474 Readback protection status: NRFDL_PROTECTION_STATUS_ALL
09:21:36.487 Parse memory regions for Application core
09:21:36.492 Update files regions according to Application core
09:21:36.492 Parse memory regions for file
09:21:36.507 Device is loaded and ready for further operation
09:21:36.512 Skipped reading, since at least one core has app readback protection
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
And the device still appears as "Protected".
I have also tried to use nrfjprog to recover the device.
I used the command:
nrfjprog --recover -f NRF52 --snr 1050359287 --log
but I get the following output:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Recovering device. This operation might take 30s.
[error] [ nRF52] - Access protection is enabled, can't read device version.
ERROR: Recover failed. Please make sure that the correct device family is given
ERROR: and try again.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have also tried to use nrfutil with the command:
./nrfutil device recover --serial-number 001050359287
and I got the following output:
<<<<<<<<<<<<<<<<<<<<<<<< Failed to recover 1050359287, [jlink] RECOVER_FAILED
Error: One or more recover tasks failed
>>>>>>>>>>>>>>>>>>>>>>>
Is there any way to recover the device?
Thank you.