<?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 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78122/nrf52840-flash-protection-with-sdk-15-0-0</link><description>Hello Everyone, 
 I am using NRF52840 development kit, I have compiled the code using SDK15.0.0. I am using soft device as well. I have to implement flash protection in my device so that any third party member can&amp;#39;t read the firmware from device. I am</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Aug 2021 12:35:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78122/nrf52840-flash-protection-with-sdk-15-0-0" /><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323318?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 12:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d12bab7-6797-48b1-87e2-aba521bc96d1</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;okay. Thank you so much for your reply.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323296?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 11:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bfc28f4-c960-4758-bb64-674609d5a86d</guid><dc:creator>Sigurd</dc:creator><description>[quote user="snehal_2789"]What will be the right way to upload the 4 files??&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;You could use mergehex, to merge these 4 files into a single hex file.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf_cltools/UG/cltools/nrf_mergehex.html"&gt;https://infocenter.nordicsemi.com/topic/ug_nrf_cltools/UG/cltools/nrf_mergehex.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323289?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 11:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15713d2c-66aa-4697-a904-2f7cb27f7f0b</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Thank you for your reply. I am using SDK15, so this feature &amp;quot;&lt;span&gt;NRF_BL_DEBUG_PORT_DISABLE&amp;quot; is not available.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yes I have commented the system reset line. What happens is I have to upload 4 files&lt;/p&gt;
&lt;p&gt;1) Bootloader file&lt;/p&gt;
&lt;p&gt;2)Softdevice file&lt;/p&gt;
&lt;p&gt;3)Application Hex file&lt;/p&gt;
&lt;p&gt;4)Config file.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now what happens if I&amp;nbsp;uncomment this line&amp;quot;NVIC_SystemReset();&amp;quot; , I upload the bootloader file first, after uploading it automatically gives a reset to board and then I am not able to upload the rest 3 files in the device as it blocks SWD. Thts the reason I commented &amp;quot;NVIC_SystemReset();&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What will be the right way to upload the 4 files??&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323281?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 10:54:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9865fdb2-dbfd-4414-bea3-5fb508e01aa5</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Looks like you have commented out the system reset.&lt;/p&gt;
&lt;p&gt;This is what the bootloader will do if &lt;span&gt;NRF_BL_DEBUG_PORT_DISABLE&amp;nbsp; is&amp;nbsp;&lt;/span&gt;set( &lt;span&gt;NRF_BL_DEBUG_PORT_DISABLE&amp;nbsp; was first introduced in SDK v16&lt;/span&gt;):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323269?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 10:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f88aa66d-a7db-4a19-b64f-0efefb0a06b2</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Hi.. Thank you for your reply. I have added the below code in my firmware in main.c:-&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint32_t APPPROTECT_reg;&lt;/p&gt;
&lt;p&gt;APPPROTECT_reg = NRF_UICR-&amp;gt;APPROTECT;&lt;br /&gt; NRF_LOG_INFO(&amp;quot;APPROTECT REG VAL IS %x&amp;quot;,APPPROTECT_reg);&lt;/p&gt;
&lt;p&gt;if (NRF_UICR-&amp;gt;APPROTECT == 0xFFFFFFFF)&lt;br /&gt; {&lt;br /&gt; NRF_LOG_INFO(&amp;quot;PROTECTING FIRMWARE...SETTING APPROTECT&amp;quot;);&lt;br /&gt; nrf_nvmc_write_word((uint32_t)&amp;amp;(NRF_UICR-&amp;gt;APPROTECT), 0xFFFFFF00);&lt;br /&gt; &lt;br /&gt; //NVIC_SystemReset();&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void nrf_nvmc_write_word(uint32_t address, uint32_t value)&lt;br /&gt;{&lt;br /&gt; // Enable write.&lt;br /&gt; NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen;&lt;br /&gt; __ISB();&lt;br /&gt; __DSB();&lt;/p&gt;
&lt;p&gt;*(uint32_t*)address = value;&lt;br /&gt; while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {;}&lt;/p&gt;
&lt;p&gt;NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren;&lt;br /&gt; __ISB();&lt;br /&gt; __DSB();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It seems to be working.I have added this in DFU BLE firmware as well. SWD,JTAG,USB gets blocked but OTA works fine.&lt;/p&gt;
&lt;p&gt;Is it the right way to do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 FLASH PROTECTION WITH SDK 15.0.0</title><link>https://devzone.nordicsemi.com/thread/323256?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 09:01:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c42a243-e076-42ec-a083-34c0b4b2fc66</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can call &amp;quot;nrfjprog --rbp ALL &amp;amp;&amp;amp; nrfjprog --reset&amp;quot; to readback protect and reset the device (to latch the new configuration). This is the&amp;nbsp;equivalent to writing to &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/uicr.html#register.APPROTECT"&gt;this register&lt;/a&gt;, and then do a reset.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In addition, you can build the bootloader with&amp;nbsp;NRF_BL_DEBUG_PORT_DISABLE set to 1 in sdk_config.h, the bootloader will then check if approtect is enabled, and if not,&amp;nbsp;enable it and reset.&lt;/span&gt;&lt;/p&gt;
[quote user=""]&lt;p&gt;&lt;span style="font-size:inherit;"&gt;4) Want to protect firmware of DFU as well.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;DFU: To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be&amp;nbsp;signed. But the package is not encrypted. See this post:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/60249/official-encrypted-secure-dfu/"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/60249/official-encrypted-secure-dfu/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>