<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70518/nrf52840-soc-jtag-port-disabling</link><description>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-&amp;gt;APPROTECT = 0x00; 
 With this we are not able to disable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Jan 2021 13:33:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70518/nrf52840-soc-jtag-port-disabling" /><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289757?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 13:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de8659a0-7414-4b45-8b08-68b774aaf5f5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Srinivas&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;Yes, If you have nrfjprog installed (from&amp;nbsp;&lt;span&gt;&lt;a title="nRF Command Line Tools" href="https://infocenter.nordicsemi.com/topic/ug_nrf_cltools/UG/cltools/nrf_command_line_tools_lpage.html?cp=9_1"&gt;nRF Command Line Tools&lt;/a&gt;&lt;/span&gt; package) and a j-link debugger connected to your board, then you can call &amp;quot;nrfjprog --recover&amp;quot; from the command line to unlock it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289630?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 08:35:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:660ed4a4-acf8-4c09-8171-de994df9771d</guid><dc:creator>Srinivas V</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Once again Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Could you please elaborate the steps with j-link, like directly go to to cmd prompt and execute the &amp;quot;nrfjporg&amp;nbsp; --recover&amp;quot; command or any other prerequisites are required.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Erasing all through CTRL-AP&lt;/p&gt;
&lt;div class="body taskbody"&gt;
&lt;p class="shortdesc"&gt;Use the standard SWD Arm&amp;reg; CoreSight&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/2122.svg" title="Tm"&gt;&amp;#x2122;&lt;/span&gt;&amp;nbsp;DAP protocol to erase all while the CTRL-AP is still selected by the DP.&lt;/p&gt;
&lt;ol class="ol steps"&gt;
&lt;li class="li step stepexpand"&gt;&lt;span class="ph cmd"&gt;Write the value 0x00000001 to the ERASEALL register (0x004) of the CTRL-AP.&lt;/span&gt;
&lt;div class="itemgroup info"&gt;This will start the ERASEALL operation which erases all flash and RAM on the device.&lt;/div&gt;
&lt;/li&gt;
&lt;li class="li step stepexpand"&gt;&lt;span class="ph cmd"&gt;Read the ERASEALLSTATUS register (0x008) of the CTRL-AP until the value read is 0x00 or 15 seconds from ERASEALL write has expired.&lt;/span&gt;&lt;/li&gt;
&lt;li class="li step stepexpand"&gt;&lt;span class="ph cmd"&gt;Write the value 0x1 to RESET register (0x000) of the CTRL-AP to issue a &amp;ldquo;soft reset&amp;rdquo; to the device and complete the erase and unlocking of the chip.&lt;/span&gt;&lt;/li&gt;
&lt;li class="li step stepexpand"&gt;&lt;span class="ph cmd"&gt;Write the value 0x0 to RESET register (0x000).&lt;/span&gt;&lt;/li&gt;
&lt;li class="li step stepexpand"&gt;&lt;span class="ph cmd"&gt;Write the value 0x0 to the ERASEALL register (0x004) of the CTRL-AP.&lt;/span&gt;
&lt;div class="itemgroup info"&gt;This is necessary after the erase sequence is completed.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289619?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 07:43:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e2fcfc4-77aa-4b37-bbce-6fa75ebf9223</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Srinivas,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you have a j-link, you can use &amp;#39;nrfjprog --recover&amp;#39; to erase the chip through the control access port. But I&amp;#39;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: &lt;span&gt;&lt;a title="Erasing all through CTRL-AP" href="https://infocenter.nordicsemi.com/topic/nwp_027/WP/nwp_027/nWP_027_erasing.html?cp=16_9_3_0_0"&gt;Erasing all through CTRL-AP&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289561?ContentTypeID=1</link><pubDate>Sat, 16 Jan 2021 16:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa525db3-117c-4499-8b69-7550de29134a</guid><dc:creator>Srinivas V</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Regarding this Jtag Disable, in forums saying that by using the&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The CTRL-AP - Control Access Port is a custom access port that enables control of the device even if the other access ports in the DAP are being disabled by access port protection.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/CTRL_5F00_AP.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;How to execute the above flow, for this any tools or HW changes are required to enable the Jtag port again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Srinivas.V&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289554?ContentTypeID=1</link><pubDate>Sat, 16 Jan 2021 12:34:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d3cedb3-b774-4f7b-b7b1-585ce7892618</guid><dc:creator>Srinivas V</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Once again thanks for your support.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void approtect(void) 

{

#if APPROTECT_ENABLE

    if ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; UICR_APPROTECT_PALL_Msk) != 
        (UICR_APPROTECT_PALL_Enabled &amp;lt;&amp;lt; UICR_APPROTECT_PALL_Pos))
    {
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NRF_UICR-&amp;gt;APPROTECT = (UICR_APPROTECT_PALL_Enabled &amp;lt;&amp;lt; UICR_APPROTECT_PALL_Pos);
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NVIC_SystemReset();
    }  

#endif //APPROTECT_ENABLE

}/**&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With the above code changes I am able to disable the debug port and not able to connect the debugger and not able to erase the flash and load the new .hex as well with Jtag port with the connected debugger(i-Jet).&lt;/p&gt;
&lt;p&gt;1. How to enable Jtag port again and how load the new hex file debugger.&lt;/p&gt;
&lt;p&gt;2. Is there any HW changes required to enable the Jtag port again for the particular nRF52840 Board.&lt;/p&gt;
&lt;p&gt;If I am able to enable the Jtag port again it would be helpful to team to debug again.&lt;/p&gt;
&lt;p&gt;Is there any flexible way to enable and disable the Jtag port SW changes itself.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Srinivas.V&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289504?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 16:34:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:950ee01c-39d4-4ce1-ac06-541e7d5ea28a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Srinivas,&lt;/p&gt;
&lt;p&gt;It has to be called before enabling the Softdevice because you are not allowed to access the NVMC while it is enabled.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s difficult to debug with readback protection, but you can try to connect the debugger to verify if approtect is enabled or not.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289502?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 16:25:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:451f187d-38aa-4b45-8d6a-87d55dd95c4b</guid><dc:creator>Srinivas V</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Is this code works for nRF52840?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which is the correct place to call this function &amp;quot;approtect()&amp;quot;, means at start of the main or initialization of any other peripherals like times , flash etc..&lt;/p&gt;
&lt;p&gt;And how to test the above functionality is working or not or is there any specific instructions to debug this code without using the debugger.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Srinivas.V&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 SOC Jtag Port disabling</title><link>https://devzone.nordicsemi.com/thread/289395?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 11:55:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:377550f0-239a-421a-a313-98a02bdac46c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Srinivas,&lt;/p&gt;
&lt;p&gt;You need to enable writing to flash in NVMC before you write to an UICR register. Here is an example of how you can do it:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;APPROTECT_ENABLE 1

void approtect(void) 

{

#if APPROTECT_ENABLE

    if ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; UICR_APPROTECT_PALL_Msk) != 
        (UICR_APPROTECT_PALL_Enabled &amp;lt;&amp;lt; UICR_APPROTECT_PALL_Pos))
    {
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NRF_UICR-&amp;gt;APPROTECT = (UICR_APPROTECT_PALL_Enabled &amp;lt;&amp;lt; UICR_APPROTECT_PALL_Pos);
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {}
        NVIC_SystemReset();
    }  

#endif //APPROTECT_ENABLE

}/**&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>