<?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>UICR won&amp;#39;t be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect</link><description>It seems that not all UICR registers are erased on this nRF52840 chip 
 nrfjprog -f nrf52 --recover 
 Just make sure one more time: 
 nrfjprog -f nrf52 --eraseuicr 
 nrfjprog -f nrf52 --readuicr uicr.bin --log Storing data in &amp;#39;uicr.bin&amp;#39;. 
 Displaying</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 May 2022 11:50:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect" /><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/368592?ContentTypeID=1</link><pubDate>Thu, 19 May 2022 11:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbc6351e-dba3-402e-aa8f-57a8530e86fb</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;This is something that is being looked into, I will update you when I learn more.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/368075?ContentTypeID=1</link><pubDate>Mon, 16 May 2022 13:51:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a8d550d-9423-412b-82c0-0e77190fc8d8</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;We can erase UICR using JLinkExe&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;halt
w4 4001E504, 2
w4 4001e50C, 1
r&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;We will see subsequently that indeed there&amp;#39;s 0xFF written to the register at 0x10001208.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1652708716228v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;After nrfjprog --recover we will find that this UICR value is overwritten by the Nordic tool to 0x5A.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1652708647502v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Hence, hereby clarifying what happens.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;@Nordic. Would you mind to add an option to nrfjprog to leave this register alone? Perhaps something like nrfjprog --someoption that erases everything WITHOUT writing to this field. For example, also e.g. nrfjprog --eraseall writes this register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367677?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 14:22:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c70b58d-5a27-47fc-9240-940b77c40c7b</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;Ah, good to know. I actually started to suspect nrfjprog indeed to do such a thing. As far as I know it&amp;#39;s not open source, pity!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll check next week if I can actually erase the entire UICR page with just the JLink and then see if nrfjprog is overwriting the value on a recover action.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367675?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 14:18:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2f62fa3-a184-49b4-a6e1-5796b1235c9a</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Be aware that there was a change in behaviour and implementation when going from rev2 to rev3 of the nRF52-series:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/comp_matrix_nrf52840/COMP/nrf52840/nRF52840_doc_ref_design_files_overview.html"&gt;https://infocenter.nordicsemi.com/topic/comp_matrix_nrf52840/COMP/nrf52840/nRF52840_doc_ref_design_files_overview.html&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/pdf/in_141_v1.1.pdf"&gt;https://infocenter.nordicsemi.com/pdf/in_141_v1.1.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The nrfjprog tool will identify the revision and handle them slightly differently due to this, e.g. on rev2 the UICR.APPROTECT likely will be set to 0xFF (disabled), while on rev3 it likely will be set to 0x5A (disabled) when using --recover option.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also be aware that there are two APPROTECT registers, one in UICR (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/uicr.html#register.APPROTECT"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf52840/uicr.html#register.APPROTECT&lt;/a&gt;) and one in RAM (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#topic"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#topic&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367669?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 14:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3faf1da8-bc6b-4f2f-b375-ac5e4b89c95b</guid><dc:creator>mrono</dc:creator><description>[quote userid="3223" url="~/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect/367663#367663"]The readback protection is removed on --recover just because 0xFF gets written to those registers.[/quote]
&lt;p&gt;This was true on the earlier chip revisions, but unfortunately it no longer applies on the latest silicon.&lt;/p&gt;
&lt;p&gt;EDIT: Ok, protection is removed by an erase, but it won&amp;#39;t stay that way after a reset unless you do the required actions.&lt;/p&gt;
&lt;p&gt;(Removed some of what I wrote because it may have been incorrect.)&lt;/p&gt;
&lt;p&gt;This new revision is simply different. You can&amp;#39;t make it behave like the old one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367665?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 13:59:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcc3251b-52e5-4ab8-8893-c25aa4094d03</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;Mmm, clicked on the vote thing by accident... I can&amp;#39;t undo it, but I don&amp;#39;t want to vote it up either. :-D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367663?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 13:57:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c71deb2-bd11-4640-a654-dc7c15a12ac4</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;It doesn&amp;#39;t truly make sense what you say. The readback protection is removed on --recover just because 0xFF gets written to those registers. And I&amp;#39;m not talking about enabling it. Just read my question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367662?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 13:54:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb4aafaa-6fb9-4b5f-8e72-7ded53000946</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;On the PCA10056 I just have 0xFF in APPROTECT. No, 0x5A&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1652363537390v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want to have it &amp;quot;Closed&amp;quot; on a pin reset. Seems a simple request to me to leave the 0xFF in that register alone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367611?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 12:34:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0517d7d2-6863-4cce-9bad-58e51a90af8c</guid><dc:creator>mrono</dc:creator><description>[quote userid="3223" url="~/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect/367604#367604"]Thanks for your help, but I want to know why I can&amp;#39;t write 0xFFFFFFFF rather than 0x5A towards that register. Or what I&amp;#39;ve to do to make that happen.[/quote]
&lt;p&gt;The thing is that this new hardware revision doesn&amp;#39;t work like that. They&amp;#39;ve changed the way the chip operates in this respect and we users can only adapt to it.&lt;/p&gt;
&lt;p&gt;have you seen the change notice IN141?&lt;/p&gt;
[quote userid="3223" url="~/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect/367604#367604"] I don&amp;#39;t want this stuff to be suddenly interfering with our flash tools in the factory depending if there has been or has not been a power cycle in that process.[/quote]
&lt;p&gt;I have actually today ordered a sample set of our product to be built with this new revision of 52840, for checking exactly this. So shortly I will be in the same situation as you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367607?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 12:30:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbd7653d-56d8-4cb6-befd-00826ab359d3</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I think part of the problem here is that we want the tools to be useful for both development and production programming, and due to backwards development compatiblity if you like, some of the parameters might not do what you intuitively expect. E.g. if recover and eraseuicr did erase flash main block/uicr, then it would quickly become a hazzle for anyone developing an application and for instance were debugging. That is why they disable readback protect when used, this is also mentioned for the recover parameter (not for eraseuicr though):&lt;/p&gt;
&lt;p&gt;--recover Erases all user available non-volatile memory and&lt;br /&gt; disables the read back protection mechanism if&lt;br /&gt; enabled.&lt;/p&gt;
&lt;p&gt;So how to enable readback protection from nrfjprog?&lt;/p&gt;
&lt;p&gt;Any other value than 0x5A to the APPROTECT register will enable readback register, so there is no need to set this register to 0xFF to enable it really. This means that to enable readback protection you can use the rbp parameter with ALL to set the register to 0 after programming, thereby readback will be enabled after a power on reset.&lt;/p&gt;
&lt;p&gt;In general I also recommend to check out:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#concept_udr_mns_1s"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#concept_udr_mns_1s&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367604?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 12:23:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f3c2ddd-1ba0-4d67-9c4d-3d266aebdea5</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;Thanks for your help, but I want to know why I can&amp;#39;t write 0xFFFFFFFF rather than 0x5A towards that register. Or what I&amp;#39;ve to do to make that happen.&lt;/p&gt;
&lt;p&gt;I think I understand what&amp;#39;s happening, namely that the nrfjprog tool automatically writes 0x5A towards that register after a recover operation.&lt;/p&gt;
&lt;p&gt;And of course I&amp;#39;ve read the documentation as well &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect&lt;/a&gt; and no, I just don&amp;#39;t want to do protection in firmware.&lt;/p&gt;
&lt;p&gt;If someone wants to glitch the thing, go ahead. Our code is open source and not locked down to begin with. So everything making flashing more cumbersome is to be removed from the process. I don&amp;#39;t want this stuff to be suddenly interfering with our flash tools in the factory depending if there has been or has not been a power cycle in that process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367598?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 12:12:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4a26fa5-dd39-496a-809b-7cb34cd01340</guid><dc:creator>mrono</dc:creator><description>&lt;p&gt;Well, improved in the sense that it is not as easily bypassed I guess.&lt;/p&gt;
[quote userid="3223" url="~/f/nordic-q-a/87846/uicr-won-t-be-completely-erased-approtect/367592#367592"]Apart from that, let&amp;#39;s just assume I want to write 0xFF rather than 0x5A there. Can I do this?[/quote]
&lt;p&gt;I suppose, but then it would still be locked, I think.&lt;/p&gt;
&lt;p&gt;You need the firmware on the device to also write some magic words to keep the device &amp;#39;unlocked&amp;#39;.&lt;/p&gt;
&lt;p&gt;This is copied from the guide I linked above:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. Start with a CTRL-AP ERASEALL operation.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;2. Program code compiled with an MDK 8.44.1 or later,&amp;nbsp;&lt;/span&gt;&lt;strong&gt;without&lt;/strong&gt;&lt;span&gt;&amp;nbsp;ENABLE_APPROTECT defined.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;3. Write HwDisabled (0x5A) to UICR.APPROTECT&lt;/span&gt;&lt;br /&gt;&lt;span&gt;4. Perform any reset to run the code. The programmed code from step 2 will open access port by writing to APPROTECT.DISABLE during start-up.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So you need the firmware to actively allow access. Otherwise the device will be locked after a power cycle.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367592?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 11:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8d6d6ab-c92a-436b-877e-70c99a33b338</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;I don&amp;#39;t think I&amp;#39;d call it &amp;quot;improved&amp;quot; if it means that after a power cycle I&amp;#39;ve to clear UICR again to be able to flash a new binary.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Apart from that, let&amp;#39;s just assume I want to write 0xFF rather than 0x5A there. Can I do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UICR won't be completely erased (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/367570?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 10:31:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f0c2cac-7fdf-4fb3-9fc0-a66c68492990</guid><dc:creator>mrono</dc:creator><description>&lt;p&gt;Isn&amp;#39;t this the new and improved APPROTECT mechanism? 0x5A is the &amp;#39;protection disabled&amp;#39; value.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>