This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[INVALID] nRF52833 read back protection, recovery not working with nrfjprog

Edit: The problem was caused by me. Solution is in replies.

I was testing read back protection functionality. For one device I've set protection using openOCD by setting APPROTECT to 0xFFFFFF00.

Currently my openOCD code can't connect after APPROTECT is enabled, so I tested with nrfjprog (nrfjprog version: 10.5.0, JLinkARM.dll version: 6.54c)

nrfjprog can't remove protection. I tested with:

nrfjprog --family NRF52 --recover
Recovering device. This operation might take 30s.
ERROR: Recover failed. Please make sure that the correct device family is given
ERROR: and try again.


also like this:

nrfjprog --recover
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.

However, I can check that after this cmd read back returns some garbage data not erased memory. Also I can verify that using openOCD.

After this I tested if I can set protection using nrfjprog:

nrfjprog --rbp all
Protected the device against read and debug. Only a --recover, --debugreset,
or --pinreset operations will work from now on.

But I could still connect to device and read memory using openOCD/stlink.

It looks to me that this doesn't work.

  • Hi,

    I am not able to reproduce, as I do not have openOCD/stlink here, but only using nrfjprog it seems to work as intended, e.g.:

    $ nrfjprog --readram ram.hex
    ERROR: The operation attempted is unavailable due to readback protection in
    ERROR: your device. Please use --recover to unlock the device.

    1) Are you able to read ram contents with nrfjprog as well?

    2) What commands, and with what output, are working with readback protection on?

    3) What is the full set of steps for reproducing?

    There might be something else going on here, such as the data reported as read is not actual data from the nRF, or the device has been recovered (with or without new firmware downloaded to flash), etc. (E.g. is the RAM contents what you expect it to be? If it is written to a file, are you sure you are reading the correct file and that it was not data from previous reads? etc.)

    Regards,
    Terje

  • Sorry, it was my mistake. I was using nRF9160-DK as jlink to program external nRF device, but connected target Vdd to P15 VIO REF not VTG as needed. So instead when using nrfjprog I was accessing demo kit nRF not the one I thought.

    Now everything works as expected.

Related