<?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>Can&amp;#39;t change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65469/can-t-change-eraseprotect-disable-value</link><description>If I write a value to ERASEPROTECT.DISABLE -- which itself works, as I&amp;#39;m fully able to perform the mass erase by writing the same value using the debugger -- I can&amp;#39;t seem to write a new value to the register during the same boot. It presumably isn&amp;#39;t flash</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Sep 2020 11:48:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65469/can-t-change-eraseprotect-disable-value" /><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/268498?ContentTypeID=1</link><pubDate>Tue, 08 Sep 2020 11:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56437e6d-8327-40c4-92ef-1746ced32c59</guid><dc:creator>&amp;#216;yvind</dc:creator><description>[quote user="erik.johnson"]Any word on the nrfjprog stuff yet? That&amp;#39;s a far more important issue for us to get figured out.[/quote]
&lt;p&gt;&amp;nbsp;It&amp;#39;s a known limitation in nrfjprog, and unfortunately no workaround yet. According to the nrfjprog team there will not be a fix until after next release.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the inconvenience this may cause.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/268331?ContentTypeID=1</link><pubDate>Mon, 07 Sep 2020 13:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63508b7a-24f7-4c2b-9b69-b9ea1ee207c8</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Okay, thanks for confirming the behavior I was seeing.&lt;/p&gt;
&lt;p&gt;Any word on the nrfjprog stuff yet? That&amp;#39;s a far more important issue for us to get figured out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/268306?ContentTypeID=1</link><pubDate>Mon, 07 Sep 2020 12:23:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10cbd447-ef78-40f4-b301-128595f22b6e</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hi Erik,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Our system architecture group reports that you are correct, and that this a Write Once register. Currently no fix available unfortunately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/268081?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2020 12:56:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e3bdca5-dfff-40a5-ae07-3c84da012890</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Hopefully someone will have some more ideas on how to get the nrfjprog programming working.&lt;/p&gt;
&lt;p&gt;As for the NVMC fields, I was mostly just talking about NVMC-&amp;gt;CONFIGNS and how the NVMC peripheral hadn&amp;#39;t been set to Non-Secure (in the SPU-&amp;gt;PERIPHID[n].PERM registers). Like I said before, though, even after setting the permission to Non-Secure nrfjprog still isn&amp;#39;t working.&lt;/p&gt;
&lt;p&gt;Looking at nAN41, it seems like nrfjprog/a debugger should be fully capable of programming the Non-Secure flash using the DAP. I&amp;#39;m definitely not experienced enough with debuggers to be able to quickly put together a custom DAP script to accomplish the programming, so I&amp;#39;ll wait to hear what the Nordic team has to say.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267952?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2020 06:43:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da0824d7-6d2b-49ca-88c4-70671fde9948</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Thanks for the feedback! This is valuable information that I will forward to our R&amp;amp;D team to verify behavior.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Investigating some more around the ERASEPROTECT, I found the following from &lt;em&gt;modules\hal\nordic\nrfx\mdk\nrf9160_bitfields.h&lt;/em&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Register: CTRLAPPERI_ERASEPROTECT_LOCK */
/* Description: Lock register ERASEPROTECT.DISABLE from being written until next reset */

/* Bit 0 : Lock register ERASEPROTECT.DISABLE from being written until next reset */
#define CTRLAPPERI_ERASEPROTECT_LOCK_LOCK_Pos (0UL) /*!&amp;lt; Position of LOCK field. */
#define CTRLAPPERI_ERASEPROTECT_LOCK_LOCK_Msk (0x1UL &amp;lt;&amp;lt; CTRLAPPERI_ERASEPROTECT_LOCK_LOCK_Pos) /*!&amp;lt; Bit mask of LOCK field. */
#define CTRLAPPERI_ERASEPROTECT_LOCK_LOCK_Unlocked (0UL) /*!&amp;lt; Register ERASEPROTECT.DISABLE is writeable */
#define CTRLAPPERI_ERASEPROTECT_LOCK_LOCK_Locked (1UL) /*!&amp;lt; Register ERASEPROTECT.DISABLE is read-only */

/* Register: CTRLAPPERI_ERASEPROTECT_DISABLE */
/* Description: Disable ERASEPROTECT and perform ERASEALL */

/* Bits 31..0 : The ERASEALL sequence will be initiated if value of KEY fields are non-zero and KEY fields match on both CPU and debugger side */
#define CTRLAPPERI_ERASEPROTECT_DISABLE_KEY_Pos (0UL) /*!&amp;lt; Position of KEY field. */
#define CTRLAPPERI_ERASEPROTECT_DISABLE_KEY_Msk (0xFFFFFFFFUL &amp;lt;&amp;lt; CTRLAPPERI_ERASEPROTECT_DISABLE_KEY_Pos) /*!&amp;lt; Bit mask of KEY field. */&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
[quote user="erik.johnson"]Ahh, it appears there is an entire section I didn&amp;#39;t know about in the NVMC section of the datasheet about specific steps to enable Non-Secure erase operations when Secure access is blocked. Hopefully all of this is my fault![/quote]
&lt;p&gt;&amp;nbsp;I assume it was the nAN41 you found?&amp;nbsp;The NVMC field (along with APPROTECT and SECUREAPPOTECT) is described in the application note &lt;a href="https://infocenter.nordicsemi.com/topic/nan_041/APP/nan_041/intro.html"&gt;nAN41 - nRF9160 Production Programming&lt;/a&gt;&amp;nbsp;under &lt;a href="https://infocenter.nordicsemi.com/topic/nan_041/APP/nan_041/troubleshooting.html"&gt;Troubleshooting&lt;/a&gt;, and the chapter &lt;a href="https://infocenter.nordicsemi.com/topic/nan_041/APP/nan_041/device_protection.html"&gt;Enabling device protection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Will get back to you with more information as soon as I know more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267895?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 15:00:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec24dac3-805d-4cb0-a4b7-5b3f195e4e6e</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;So, looks like we weren&amp;#39;t setting NVMC to Non-Secure-accessible in the peripheral permission registers, which was preventing the debugger from using those registers at all. I found that, if I allow Non-Secure access to them and didn&amp;#39;t use ERASEPROTECT, I could set SECUREAPPROTECT and the debugger could still do its nrfjprog --recover process. But, if I turn ERASEPROTECT back on, nrfjprog will no longer do anything, including --program &amp;lt;file&amp;gt; --sectorerase, since it doesn&amp;#39;t like that &amp;quot;readback protection&amp;quot; is on.&lt;/p&gt;
&lt;p&gt;Since we don&amp;#39;t want to allow anyone to erase our UICR and our Secure flash, we have to use ERASEPROTECT. Both 10.7.0 and 10.9.0 will not do the --sectorerase operation nor a manual --erasepage operation. Do you know what the &amp;quot;readback protection&amp;quot; is conditioned on? Is it something that could be bypassed in order to still do the page erase/flash write operations? I would think with NVMC now being Non-Secure-accessible this should work from the debugger.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267888?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 14:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bd79c99-439c-46b1-97be-8e191b516cb3</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Ahh, it appears there is an entire section I didn&amp;#39;t know about in the NVMC section of the datasheet about specific steps to enable Non-Secure erase operations when Secure access is blocked. Hopefully all of this is my fault!&lt;/p&gt;
&lt;p&gt;Although the debugger should have access to these registers, since there are Non-Secure sets for them, so I would hope nrfjprog would already be setting these up if needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267882?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 14:21:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d15da056-fb9a-4658-bebf-d55e7a572e65</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Looks like not enabling ERASEPROTECT has no effect on the access to the Non-Secure flash. I removed that part of our setup (when enabling SECUREAPPROTECT) and nothing changed for either 10.7.0 or 10.9.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267877?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 13:54:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92c3a25d-d6ff-4f0b-ab9d-d9e0491bb339</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;The issue in this ticket isn&amp;#39;t impacted by nrfjprog, since it&amp;#39;s just code execution that&amp;#39;s doing the reading/writing, but regarding the previous ticket, it looks like 10.7.0 has an issue with recognizing my device, which I don&amp;#39;t think I&amp;#39;ve ever seen in 10.9.0. I&amp;#39;ve seen two behaviors when trying to reprogram the Non-Secure flash with 10.7.0:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog.exe --program build/at_widget/zephyr/app_signed.hex --sectorerase
Parsing hex file.
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog.exe --program build/at_widget/zephyr/app_signed.hex --sectorerase
ERROR: nrfjprog could not identify the target device. This may be due to an
ERROR: invalid family argument, a problem with your device, or nrfjprog may
ERROR: not yet support your device.
ERROR: Please check the family argument passed, or upgrade nrfjprog to a more
ERROR: recent version.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The first one occurs more often, but I&amp;#39;ve seen the second one show up a few times. I&amp;#39;m wondering if the first is occurring when the ARM core is running Secure flash firmware and the second is when the ARM core is running Non-Secure firmware. I&amp;#39;m going to play with that more to see if I can confirm it, and I&amp;#39;m also going to go back to 10.9.0 to see if I can reproduce the different behaviors.&lt;/p&gt;
&lt;p&gt;At any rate, it seems like 10.7.0 still has issues with reprogramming Non-Secure firmware when APPROTECT has _not_ been set but SECUREAPPROTECT has been. It also seemed to have trouble reprogramming at all when SECUREAPPROTECT hadn&amp;#39;t been set.&lt;/p&gt;
&lt;p&gt;Another variable I didn&amp;#39;t think to bring up is that ERASEPROTECT (in the UICR) is also being set to avoid allowing a mass erase of flash and the UICR (and only allowing a mass erase using the ERASEPROTECT.DISABLE register). It doesn&amp;#39;t seem like this should prevent the debugger from being able to reprogram flash, though, since nrfjprog --program &amp;lt;file&amp;gt; --sectorerase should be doing individual page erases and writes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267867?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 13:30:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cb856f7-e81e-403d-864c-cb45fba637fe</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Yep, will do!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267866?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2020 13:29:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4a6e50-0446-4660-aae9-03b785c5f383</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hi Erik,&amp;nbsp;&lt;br /&gt;The issue might seem to be related to your previous support ticket (#255468). We&amp;#39;ve found a bug in nrfjprog, which might also be the root cause to what you are seeing in your last ticket.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you possibly test using an older nrfjprog e.g. 10.7.0?&lt;br /&gt;&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267652?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2020 13:51:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:060e742e-8134-4aae-b125-455bf166a1b5</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Looks like DISABLE is being read as zero, even after writing to it (which I&amp;#39;ve verified is working, since I can write from the debugger to trigger the mass erase). The register description in the datasheet indicates it should be read/write.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, clearly there&amp;#39;s some under-the-hood handling of this register in the core that makes it act a little differently than other registers. This isn&amp;#39;t any kind of a show-stopper, but it doesn&amp;#39;t seem to behave the way I&amp;#39;d expect it to having read the datasheet.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267639?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2020 13:16:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4366ce47-5b5c-4ee4-9879-8c1d748958aa</guid><dc:creator>erik.johnson</dc:creator><description>&lt;p&gt;Right, but I&amp;#39;m not setting the LOCK bit at all, so I would expect to be able to write to DISABLE more than once. I was just trying to understand if it was able to be written to more than once, since it seems like a straightforward register.&lt;/p&gt;
&lt;p&gt;I suppose I haven&amp;#39;t checked, but is LOCK automatically set if I write to DISABLE?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't change ERASEPROTECT.DISABLE value</title><link>https://devzone.nordicsemi.com/thread/267635?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2020 13:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be3c47da-e7af-473a-8459-47177657f041</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found the following in&amp;nbsp;&lt;em&gt;modules\hal\nordic\nrfx\mdk\nrf9160.h&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
  * @brief CTRLAPPERI_ERASEPROTECT [ERASEPROTECT] (Unspecified)
  */
typedef struct {
  __IOM uint32_t  LOCK;                         /*!&amp;lt; (@ 0x00000000) Lock register ERASEPROTECT.DISABLE from being
                                                                    written until next reset                                   */
  __IOM uint32_t  DISABLE;                      /*!&amp;lt; (@ 0x00000004) Disable ERASEPROTECT and perform ERASEALL                  */
} CTRLAPPERI_ERASEPROTECT_Type;                 /*!&amp;lt; Size = 8 (0x8)    &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>