<?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>Application merged with bootloader causing read back protection, how to get rid of read back protection while doing so</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105597/application-merged-with-bootloader-causing-read-back-protection-how-to-get-rid-of-read-back-protection-while-doing-so</link><description>Need to give merged hex in production where I can read out the sensor status after programming which is stored in flash area, but merged hex is going into read back protection without hindering any data on the UICR.APPROTECT.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Nov 2023 09:19:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105597/application-merged-with-bootloader-causing-read-back-protection-how-to-get-rid-of-read-back-protection-while-doing-so" /><item><title>RE: Application merged with bootloader causing read back protection, how to get rid of read back protection while doing so</title><link>https://devzone.nordicsemi.com/thread/455710?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2023 09:19:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3173579e-59b9-4318-80de-e550cb1cdafe</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What you describe here should work, and when I test on my end with your&amp;nbsp;approtect_hw_disable() function and the same nrfjprog commands I am able to read back afterwards. Can you check if you have&amp;nbsp;ENABLE_APPROTECT defined in your project? (If you do, the debug interface will stay locked down regardless of what is in UICR).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application merged with bootloader causing read back protection, how to get rid of read back protection while doing so</title><link>https://devzone.nordicsemi.com/thread/455447?ContentTypeID=1</link><pubDate>Tue, 14 Nov 2023 06:19:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cacbfda3-8c0a-45de-bae2-cf1656dad305</guid><dc:creator>Gaurav</dc:creator><description>&lt;p&gt;Yes the application is built on SDK 17.1.0 and the commands used to program the device is -&lt;/p&gt;
&lt;p&gt;nrfjprog --recover&lt;br /&gt; nrfjprog --program %merged_hex% --chiperase&amp;nbsp; --verify --reset&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And in the application we have used :&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void approtect_hw_disable(void)
{
    if ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; UICR_APPROTECT_PALL_Msk) 
       == (UICR_APPROTECT_PALL_Msk))
    {
        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_HwDisabled &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();
    }  
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application merged with bootloader causing read back protection, how to get rid of read back protection while doing so</title><link>https://devzone.nordicsemi.com/thread/455312?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 13:46:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cffabe66-89dc-4d0a-b7b2-cdd2aaeca19d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Read back protection is enabled by default on the latest generation of the nRF52840, so it must be explicitly disabled both by hardware (controlled by UICR) and software (see &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html?cp=5_0_0_3_7_1#concept_udr_mns_1s"&gt;Access port protection&lt;/a&gt;). Which exact set of commands to you use to program your device? And is the application built with SDK 17.1.0 (or an updated MDK if using an older SDK, ref &lt;a href="https://infocenter.nordicsemi.com/pdf/in_141_v1.1.pdf?cp=19_24"&gt;IN141&lt;/a&gt;)?&lt;/p&gt;
&lt;p&gt;The tools we provide are designed to make this simpler, so if you first recover using &amp;quot;nrfjprog --recover&amp;quot; this will open the debug port in the UICR and writ a small firmware that opens the debug port. When you subsequently write your firwmare, this must also be built to open the debug port (which it does by default in SDK 17.1.0). And with that, you will be able to read the flash after programming. If that does not work, either the UIRC does not contain the magic word or the firmware does not write the magic word runtime (which it does by default) or both, and then we need to look more closely at that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>