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

How do I disable control access port protection on nRF52 using openOCD?

I am using openOCD as the debugger for my nRF52 device. Nothing is working anymore. I am seeing errors like:

$ Error: Could not find MEM-AP to control the core
$ Error: Target not examined yet

whenever I try to do a command. I think the chip is locked/protected. I might have accidentally/purposefully enabled control access port protection, but now I want to unlock the chip so I can actually use it again.

Parents
  • If you are using openOCD and enable control access port protection on an nRF52 device, it is difficult to unlock if you don't know what to do.

    Using openOCD, you can check if access protection is enabled by executing the command: > dap apreg 1 0x0c

    This command reads the register at address 0x0c in the access port at index 1 (the control access port's index). If it returns 0x0 then access port protection is enabled.

    Unlock the chip by executing the command:

    > dap apreg 1 0x04 0x01

    and then resetting the device. Note that this will erase all Flash and RAM as this is the only way to disable CTRL-AP protection.

    Note: The easiest solution would be to use Nordic's nrfjprog to unlock your chip via $ nrfjprog -f NRF52 --recover, but this requires the use of a JLink debugger (on-board nRF5 DKs or external).

Reply
  • If you are using openOCD and enable control access port protection on an nRF52 device, it is difficult to unlock if you don't know what to do.

    Using openOCD, you can check if access protection is enabled by executing the command: > dap apreg 1 0x0c

    This command reads the register at address 0x0c in the access port at index 1 (the control access port's index). If it returns 0x0 then access port protection is enabled.

    Unlock the chip by executing the command:

    > dap apreg 1 0x04 0x01

    and then resetting the device. Note that this will erase all Flash and RAM as this is the only way to disable CTRL-AP protection.

    Note: The easiest solution would be to use Nordic's nrfjprog to unlock your chip via $ nrfjprog -f NRF52 --recover, but this requires the use of a JLink debugger (on-board nRF5 DKs or external).

Children
Related