<?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>APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122864/approtect-and-verify-with-nrfjprog</link><description>Hi 
 On the nRF52840-QIAA-R there should be implemented the APPROTECT according to this guide: 
 https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect 
 Informational Notice (IN) - Vulnerability</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Jul 2025 11:28:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122864/approtect-and-verify-with-nrfjprog" /><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/543332?ContentTypeID=1</link><pubDate>Wed, 23 Jul 2025 11:28:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:002d34a1-9d2f-4689-9b72-6e9ed1f7afa4</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This looks like a good approach and the code snippet also looks nice. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/543215?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 13:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d684ad4-8063-4911-b7e2-375d343bcce4</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;Hi Priyanaka&lt;/p&gt;
&lt;p&gt;With the UIR flags its possible and working like expected.&lt;/p&gt;
&lt;p&gt;The logic is the following: Bootloader has its own UICR (index 1), application has its own UICR (index 0).&lt;/p&gt;
&lt;p&gt;If the index is empty, the bootloader and app is writing the predefined value to this index. Next restart (Reset, Power Reset) the code is checking this value and is writing the AppProtection Flag following by a reset. This logic is needed to ensure that the fisrt time the AppProtect is not activated, second time yes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The if is preventing that this is happening at every reset, it will happen only once:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void AppProtection(void)
{
#ifdef ENABLE_APPROTECT
    if (!is_customer_magic_set())
    {
        NRF_LOG_DEBUG(&amp;quot;Customer Magic is not active&amp;quot;);
        uicr_write_customer_magic();
    }
    else
    {
        NRF_LOG_DEBUG(&amp;quot;Enable AppProtection&amp;quot;);
        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;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}

            NRF_UICR-&amp;gt;APPROTECT = ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; ~((uint32_t)UICR_APPROTECT_PALL_Msk)) |
                (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;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}

            NVIC_SystemReset();
        }
#else
    	if ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; UICR_APPROTECT_PALL_Msk) !=
    		(UICR_APPROTECT_PALL_HwDisabled &amp;lt;&amp;lt; UICR_APPROTECT_PALL_Pos))
        {

            NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}

            NRF_UICR-&amp;gt;APPROTECT = ((NRF_UICR-&amp;gt;APPROTECT &amp;amp; ~((uint32_t)UICR_APPROTECT_PALL_Msk)) |
    		    (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;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}

            NVIC_SystemReset();
    	}
#endif
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your help and if there is any issue or problem in the code please let me know&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542348?ContentTypeID=1</link><pubDate>Mon, 14 Jul 2025 09:33:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5579dbd0-5003-45d4-9996-883b23b21e80</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi Dominik,&lt;/p&gt;
&lt;p&gt;That does sound like a good way. And you are also&amp;nbsp;right that&lt;strong&gt; --eraseall&lt;/strong&gt; resets UICR, including protection flags.&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542295?ContentTypeID=1</link><pubDate>Sat, 12 Jul 2025 07:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9baa2152-87d5-49cd-b91c-663c40b220b1</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;I think it&amp;#39;s possible to use&amp;nbsp;NRF_UICR-&amp;gt;CUSTOMER[x] flag to enable the&amp;nbsp;NRF_UICR-&amp;gt;APPROTECT only after the second Reset/Boot, and with&amp;nbsp;nrfjprog --eraseall the flags in uicr will be reset to default before flashing.I will try&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542271?ContentTypeID=1</link><pubDate>Fri, 11 Jul 2025 15:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a088bcc-8b70-452a-835b-da5937b16040</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;Ok, now I managed to enable ReadProtect only the second time after reset because of the Verify issue.&lt;br /&gt;To manage this, I use a command line before program / verify and check this value in the App:&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrfjprog --memwr 0x000F5000 --val 0x12345678&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;if I read the address before enabling the ReadBackProtection I read 0xDEADC0DE&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog --memrd 0x000F5000 0x000F5000: DEADC0DE &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;my bootloader is starting at&amp;nbsp;0xF6000 and has 32kB, so in the memory map the part lower than 0xF6000 should be empty, but what this&amp;nbsp;0xDEADC0DE is meaning?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8322.MemoryLayout.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Is it safe to use this region below (grey) or should I avoid this? Is there any other way to do the ReadBackProtection in the App only after the second Reset without this Falsh? UICR is not working, I guess the internal falsh is ok only the&amp;nbsp;0xDEADC0DE is confusing me...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542224?ContentTypeID=1</link><pubDate>Fri, 11 Jul 2025 11:05:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10844ffe-51d4-42d2-aea5-9d8e3c84e94c</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi Dominik,&lt;/p&gt;
&lt;p&gt;Your understanding is correct. Please take a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/106875/implentation-of-read-back-protection-on-nrf52840#:~:text=Here%20are%20some,Vote"&gt;this ticket &lt;/a&gt;where a colleague of mine has described clearly regarding the differences between old and new revisions.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542069?ContentTypeID=1</link><pubDate>Thu, 10 Jul 2025 09:21:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:210d80c8-b92b-4887-9001-3a1af5bcbbf6</guid><dc:creator>Dominik Eugster</dc:creator><description>[quote userid="107899" url="~/f/nordic-q-a/122864/approtect-and-verify-with-nrfjprog"]&lt;a title="https://www.mouser.com/PCN/Nordic_Semiconductor_IN_133_v1.0.pdf?_gl=1*7gc3uw*_ga*MTEwMTU2NjQ5Mi4xNjkyMTg0OTY2*_ga_15W4STQT4T*MTcwMjU2MzMyNy4yNS4xLjE3MDI1NjM1NjcuNTcuMC4w" href="https://www.mouser.com/PCN/Nordic_Semiconductor_IN_133_v1.0.pdf?_gl=1*7gc3uw*_ga*MTEwMTU2NjQ5Mi4xNjkyMTg0OTY2*_ga_15W4STQT4T*MTcwMjU2MzMyNy4yNS4xLjE3MDI1NjM1NjcuNTcuMC4w"&gt;&lt;strong&gt;Informational Notice (IN) - Vulnerability&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;of the nRF52 series.[/quote]
&lt;p&gt;With these Software functions this Bug can be fixed because every restart is protecting the MCU again which is not the case when the APPROTECT function in the bootloader and the App is not active, is this correct? Even if &lt;strong&gt;nrfjprog --rbp ALL &lt;/strong&gt;is used in the flashing process at the end.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542058?ContentTypeID=1</link><pubDate>Thu, 10 Jul 2025 08:53:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8f21352-b12d-4aaf-a829-e85a194d7394</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;Hi Priyanka&lt;/p&gt;
&lt;p&gt;The --eraseall is needed after a recover?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried but its not working, the MCU starts running and enable APPROTECT before verify is finished:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;**********************************************************************
&amp;quot;Recover and disable the read back protection&amp;quot;
**********************************************************************
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Erasing user available code and UICR flash areas.
Applying system reset.
**********************************************************************
&amp;quot;Reset, Program and Verify the Device&amp;quot;
**********************************************************************
[ #################### ]   6.253s | Program file - Done programming
[error] [  nRF52] - Failed while performing &amp;#39;Verify&amp;#39; operation on target address 0x00001000.
-160: Data does not match in address range [0x00001000 - 0x00026497] (Flash)
Expected byte value 0x00 but read 0xFB at address 0x0001A468.
[error] [ Client] - Encountered error -160: Command verify_file executed for 1777 milliseconds with result -160
[error] [  nRF52] - Failed while verifying device. -160: Data does not match in address range [0x00001000 - 0x00026497] (Flash)
Expected byte value 0x00 but read 0xFB at address 0x0001A468.
[error] [ Worker] - Data does not match in address range [0x00001000 - 0x00026497] (Flash)
Expected byte value 0x00 but read 0xFB at address 0x0001A468.
ERROR: Write verify failed.
Error occurred, errorlevel: 55
Error on the burning process with &amp;quot;nrfjprog --reset --program --verify&amp;quot;
**********************************************************************
&amp;quot;PROGRAMMING and VERIFY ERROR&amp;quot;
**********************************************************************
Dr&amp;#252;cken Sie eine beliebige Taste . . .

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542050?ContentTypeID=1</link><pubDate>Thu, 10 Jul 2025 08:36:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb1cca02-9d04-4cf6-bd16-3e5c52333b50</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi Dominik,&lt;/p&gt;
[quote user="Dominik Eugster"]Is my understanding and the functions in the bootloader and App correct?[/quote]
&lt;p&gt;Yes that&amp;#39;s right.&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/nrf5_SDK_v17.1.1/page/lib_secure_boot.html#secure_boot_debug_prod"&gt;https://docs.nordicsemi.com/bundle/nrf5_SDK_v17.1.1/page/lib_secure_boot.html#secure_boot_debug_prod&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Dominik Eugster"]If yes, the only question is how to flash the nRF52840 with nrfjprog and use the verify, or is there an option to ensure a correct download without verify?[/quote]
&lt;p&gt;Could you try the following:&lt;/p&gt;
&lt;p&gt;nrfjprog -f NRF52 --recover&lt;br /&gt;nrfjprog -f NRF52 --eraseall&lt;br /&gt;nrfjprog -f NRF52 --program file.hex --verify&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: APPROTECT and verify with nrfjprog</title><link>https://devzone.nordicsemi.com/thread/542034?ContentTypeID=1</link><pubDate>Thu, 10 Jul 2025 07:55:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0e8e06f-d2f3-4077-837c-4a5e7b035acf</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;And in the bootloader the debug_port_disable function will be called aswell when the SDK_config&amp;nbsp;NRF_BL_DEBUG_PORT_DISABLE is enabled:&lt;pre class="ui-code" data-mode="c_cpp"&gt;void nrf_bootloader_debug_port_disable(void)
{
    if (NRF_UICR-&amp;gt;APPROTECT != 0x0)
    {
        nrf_nvmc_write_word((uint32_t)&amp;amp;NRF_UICR-&amp;gt;APPROTECT, 0x0);
        NVIC_SystemReset();
    }
#if (!defined (NRF52810_XXAA) &amp;amp;&amp;amp; !defined (NRF52811_XXAA) &amp;amp;&amp;amp; !defined (NRF52832_XXAA) &amp;amp;&amp;amp; !defined (NRF52832_XXAB))
    if (NRF_UICR-&amp;gt;DEBUGCTRL != 0x0)
    {
        nrf_nvmc_write_word((uint32_t)&amp;amp;NRF_UICR-&amp;gt;DEBUGCTRL, 0x0);
        NVIC_SystemReset();
    }
#endif
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So at the end the device is starting in the bootloader and the function above will enbale the APPROTECT. If a device is running without bootloader (only in development), then the function on top of the main will enable the&amp;nbsp;APPROTECT with the function &amp;quot;AppProtection()&amp;quot;&lt;/p&gt;
&lt;p&gt;Is my understanding and the functions in the bootloader and App correct?&lt;/p&gt;
&lt;p&gt;If yes, the only question is how to flash the nRF52840 with nrfjprog and use the verify, or is there an option to ensure a correct download without verify?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>