This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

APPROTECT and DAP

Hi,

I have a JLink script which sets APPROTECT in the UICR to enable readback protection and disable the debug interface.

For development purposes, I would like to be able to clear these. The process seems to be to write certain values to the CTRL-AP registers. However, I cannot find the base memory address for the DAP or CTRL-AP registers anywhere in the nRF52832 1. 0 data sheet. Does anyone know the base address for this register set? If not part of the memory space register, how would I command JLink to write data to the appropriate place to erase the chip after read back protection has been enabled?

Thanks,

Eric

Parents
  • I figured out the solution:

    You cannot ask JLink Commander to connect to the device after APPROTECT is set. This causes commander to switch to some state where SWDWriteDP/SWDReadDP always fails with an error. I don't fully understand what state the connect command causes in JLink Commander. Instead, after starting JLInk Commander send only the SWDSelect command.

    1. Start JLink Commander

    2. SWDSelect -> Selects SWD Interface

    3. SWDWriteDP 1 0x50000000 -> Enable power (as suggested by Segger response)

    4. SWDWriteDP 2 0x01000000 -> Seleect CTRL-AP Bank 0

    5. SWDWriteAP 1 0x00000001 -> Full Chip Erase

    6. SWDReadAP 2 -> Repeat until 0

    7. SWDReadAP 3 -> Two reads show 0x00000001 meaning protection cleared

    Thanks for the help.

Reply
  • I figured out the solution:

    You cannot ask JLink Commander to connect to the device after APPROTECT is set. This causes commander to switch to some state where SWDWriteDP/SWDReadDP always fails with an error. I don't fully understand what state the connect command causes in JLink Commander. Instead, after starting JLInk Commander send only the SWDSelect command.

    1. Start JLink Commander

    2. SWDSelect -> Selects SWD Interface

    3. SWDWriteDP 1 0x50000000 -> Enable power (as suggested by Segger response)

    4. SWDWriteDP 2 0x01000000 -> Seleect CTRL-AP Bank 0

    5. SWDWriteAP 1 0x00000001 -> Full Chip Erase

    6. SWDReadAP 2 -> Repeat until 0

    7. SWDReadAP 3 -> Two reads show 0x00000001 meaning protection cleared

    Thanks for the help.

Children
Related