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

NRF52840 SOC Jtag Port disabling

Hi Team,

We are using the nRF52840 for our development purpose. For sake Cyber security purpose we need to disable the Jtag debug port. 

For this we have used the below code snippet,

   NRF_UICR->APPROTECT = 0x00;

With this we are not able to disable the Jtag Debug Port, is there any other way to disable the port.

Could any one share the Jtag disabling part of code for nRF52840, without impacting the our rest of the Peripherals means Flash, BLE  and other peripherals.

Regards,

Srinivas.V

  • Hi Srinivas,

    If you have a j-link, you can use 'nrfjprog --recover' to erase the chip through the control access port. But I'm not sure if there is an easy way to do the same with the i-jet debugger. It will need to perform the following sequence to disable approtect: Erasing all through CTRL-AP

    Regards,

    Vidar

  • Hi Vidar,

    Once again Thanks for your reply.

    Could you please elaborate the steps with j-link, like directly go to to cmd prompt and execute the "nrfjporg  --recover" command or any other prerequisites are required.

    Is there any terminal or any tool required to execute the below steps, or how to access these CTRL_AP registers externally, why means my j-tag port is already locked.

    Erasing all through CTRL-AP

    Use the standard SWD Arm® CoreSightTm DAP protocol to erase all while the CTRL-AP is still selected by the DP.

    1. Write the value 0x00000001 to the ERASEALL register (0x004) of the CTRL-AP.
      This will start the ERASEALL operation which erases all flash and RAM on the device.
    2. Read the ERASEALLSTATUS register (0x008) of the CTRL-AP until the value read is 0x00 or 15 seconds from ERASEALL write has expired.
    3. Write the value 0x1 to RESET register (0x000) of the CTRL-AP to issue a “soft reset” to the device and complete the erase and unlocking of the chip.
    4. Write the value 0x0 to RESET register (0x000).
    5. Write the value 0x0 to the ERASEALL register (0x004) of the CTRL-AP.
      This is necessary after the erase sequence is completed.

  • Hi Srinivas,

    Yes, If you have nrfjprog installed (from nRF Command Line Tools package) and a j-link debugger connected to your board, then you can call "nrfjprog --recover" from the command line to unlock it.

Related