<?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>Read/write UICR CUSTOMER register under Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96784/read-write-uicr-customer-register-under-zephyr</link><description>This topic has a lot of info but most is outdated and confusing 
 For the latest SDK 2.2.0 under Zephyr 
 -Does the Soft Device have to be disabled before NRF_UICR-&amp;gt;CUSTOMER area can be written? 
 If yes: 
 What API should be used? 
 -Is a reboot required</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Feb 2023 20:52:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96784/read-write-uicr-customer-register-under-zephyr" /><item><title>RE: Read/write UICR CUSTOMER register under Zephyr</title><link>https://devzone.nordicsemi.com/thread/410727?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2023 20:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b333ab66-a27d-456d-a641-ce87f3001965</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Andy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read/write UICR CUSTOMER register under Zephyr</title><link>https://devzone.nordicsemi.com/thread/410633?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2023 12:23:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caa0a1f6-13d7-484c-98b6-0ac3ff912e19</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Update:&lt;/p&gt;
&lt;p&gt;I found an API for the NVMC: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfx/drivers/nvmc/index.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfx/drivers/nvmc/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read/write UICR CUSTOMER register under Zephyr</title><link>https://devzone.nordicsemi.com/thread/410626?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2023 12:11:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4076c162-fefe-456f-a7e5-4a2ad7ecf7b5</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]-Does the Soft Device have to be disabled before NRF_UICR-&amp;gt;CUSTOMER area can&amp;nbsp; be written?[/quote]
&lt;p&gt;The UICR is written using the NVMC. In the nRF5 SDK, the Soft Device prevented the application from using the NVMC.&lt;br /&gt;However, I do not think the SoftDevice Controller in the nRF Connect SDK prevents this.&lt;/p&gt;
&lt;p style="margin:0;padding:0;text-align:left;"&gt;So I think it should work fine.&lt;/p&gt;
&lt;p style="margin:0;padding:0;text-align:left;"&gt;&lt;/p&gt;
[quote user=""]What API should be used?[/quote]
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;The NVMC and UICR are simple enough not to need an API.&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration:line-through;"&gt;See my unofficial sample for an example of how to write to the UICR: &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/ctrl-ap/eraseprotect/src/main.c#L10-L15"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/ctrl-ap/eraseprotect/src/main.c#L10-L15&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;EDIT: See new comment on API&lt;/p&gt;
&lt;p&gt;(This code/configuration is not thoroughly tested or qualified and should be considered provided &amp;quot;as-is&amp;quot;. Please test it with your application and let me know if you find any issues.)&lt;/p&gt;
[quote user=""]-Is a reboot required?[/quote]
&lt;p&gt;Yes. From &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/nvmc.html?cp=5_5_0_3_2_2#concept_etv_shz_vr"&gt;Writing to user information configuration registers (UICR)&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&amp;quot;User information configuration registers (UICR) are written in the same way as flash. After UICR has been written, the new UICR configuration will take effect after a reset.&amp;quot;&lt;/p&gt;
[quote user=""]-Should the UICR be erased first ? (some posts say it should)&amp;nbsp;[/quote]
&lt;p&gt;Short answer: Yes&lt;/p&gt;
&lt;p&gt;Long answer:&lt;/p&gt;
&lt;p&gt;When erased, all flash bits are set to &amp;quot;1&amp;quot;. The NVMC can only change 1-&amp;gt;0. So if you can change 0b11110000 -&amp;gt; 0b01110000, but not 0b11110000 -&amp;gt; 0b11110001.&lt;br /&gt;From &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/nvmc.html?cp=5_5_0_3_2_0#concept_ghg_zdz_vr"&gt;Writing to flash&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&amp;quot;The NVMC is only able to write &lt;code&gt;0&lt;/code&gt; to bits in the flash that are erased (set to &lt;code&gt;1&lt;/code&gt;). It cannot rewrite a bit back to &lt;code&gt;1&lt;/code&gt;. Only full 32-bit words can be written to flash using the NVMC interface. [...]&amp;quot;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>