<?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: critical: reset loop when updating UICR.APPROTECT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114591/nrf52840-critical-reset-loop-when-updating-uicr-approtect</link><description>Hi all, 
 I am aware of the different access port protection mechanisms (listed in my previous ticket here: Link ). I did also test both revisions successfully: 
 
 
 For older revisions &amp;lt;= 2: it is enough to write 0xFFFFFF00 to the UICR.APPROTECT register</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Sep 2024 09:10:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114591/nrf52840-critical-reset-loop-when-updating-uicr-approtect" /><item><title>RE: nrf52840: critical: reset loop when updating UICR.APPROTECT</title><link>https://devzone.nordicsemi.com/thread/502252?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 09:10:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b2bbf80-0c9a-4c16-9d71-8d7ad1bc3683</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This looks better, checking only the part of the register that matters. Wiht this implementation it does not matter if you write&amp;nbsp;0x00000000 or&amp;nbsp;0xFFFFFF00.&lt;/p&gt;
&lt;p&gt;Our tools will write 0xFFFFFF00 to lock the older revision deivices, so if you want to do the same you can do that, but the effect will be the same, so I do not recommend any particular approach in this case.&lt;/p&gt;
&lt;p&gt;(But of corse generally the good practice is to only change bits specified in the datasheet as in some cases there may be undocumented/hidden fields,&amp;nbsp;though tnat is not the case here. And the same time our tools write&amp;nbsp;&lt;span&gt;0x0000005A (not 0xFFFFFF5A) to &lt;em&gt;unlock&lt;/em&gt; the 3. revision devices).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840: critical: reset loop when updating UICR.APPROTECT</title><link>https://devzone.nordicsemi.com/thread/502068?ContentTypeID=1</link><pubDate>Wed, 11 Sep 2024 09:45:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8036ac80-de0a-482c-8410-f792bd325353</guid><dc:creator>lanwer</dc:creator><description>&lt;p&gt;Thanks for your feedback.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have already updated my&amp;nbsp;&lt;span&gt;nrf_enable_access_port_protection() function to check only for the last byte&amp;nbsp;instead of&amp;nbsp;the whole word. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void nrf_enable_access_port_protection(void)
{
	if (NRF_UICR-&amp;gt;APPROTECT &amp;amp; 0x000000FF != 0x00)
    {
		LOG_WRN(&amp;quot;Access Port Protection is not enabled --&amp;gt; Enable Access Port Protection now&amp;quot;);

		/* Enable Access Port Protection
		 * Access through debugger to CPU registers, mapped-memory and RAM will be disabled
		 * To disable protection ERASEALL command must be applied. */
		flash_write_word((uint32_t)&amp;amp;NRF_UICR-&amp;gt;APPROTECT, 0xFFFFFF00);

		LOG_INF(&amp;quot;Access Port Protection is now enabled --&amp;gt; Reboot to apply the config...&amp;quot;);

		// Sleep is only necessary to show the logs before reboot for debug purposes
		k_sleep(K_MSEC(2000));

		sys_reboot(SYS_REBOOT_COLD);
    }
	else
	{
		LOG_INF(&amp;quot;Access Port Protection is already enabled&amp;quot;);
		monitoring_update_text(&amp;quot;system.approtect&amp;quot;, nrf52_configuration_249() ? &amp;quot;enabled/rev 3+&amp;quot; : &amp;quot;enabled/rev 2-&amp;quot;);
	}
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;Would you recommend writing 0x00000000 instead of 0xFFFFFF00 as well?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color:#2f2f2f;padding:0px 0px 0px 2px;"&gt;&lt;span style="background-color:#2f2f2f;color:#aaaaaa;font-family:&amp;#39;Monospace&amp;#39;;font-size:10pt;white-space:pre;"&gt;&lt;span style="color:#d9e8f7;"&gt;&lt;/span&gt;&lt;span style="color:#a7ec21;font-weight:bold;"&gt;flash_write_word&lt;/span&gt;&lt;span style="color:#f9faf4;"&gt;((&lt;/span&gt;&lt;span style="color:#d9e8f7;"&gt;uint32_t&lt;/span&gt;&lt;span style="color:#f9faf4;"&gt;)&lt;/span&gt;&lt;span style="color:#e6e6fa;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color:#d9e8f7;"&gt;NRF_UICR&lt;/span&gt;&lt;span style="color:#e6e6fa;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#d9e8f7;"&gt;APPROTECT&lt;/span&gt;&lt;span style="color:#e6e6fa;"&gt;,&lt;/span&gt;&lt;span style="color:#d9e8f7;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;0xFFFFFF00&lt;/span&gt;&lt;span style="color:#f9faf4;"&gt;)&lt;/span&gt;&lt;span style="color:#e6e6fa;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840: critical: reset loop when updating UICR.APPROTECT</title><link>https://devzone.nordicsemi.com/thread/501906?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 11:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59f9af44-928f-44f6-a454-2374094d9fa7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the feedback. I see that the documetnation is unclear in this regard. For persistent registers in the UICR the reset value does not indicate the value after a normal reset as these are presistent registers. Instead, this refers to the value the register has after an erase all operation. So if the register has been written to it will keep that value, and that include the whole 32 bit register, not just the lower 8 bits.&lt;/p&gt;
&lt;p&gt;Our tools will always write 0x5A to the whole word (so that it reads 0x0000005A) and the register has no other uses, so this is what I recomend that you do (and update your&amp;nbsp;nrf_enable_access_port_protection() function accordingly).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>