<?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>How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18257/how-to-write-data-to-uicr-customer-registers</link><description>I have some keyword, want to save to UICR CUSTOMER registers.
Then, when I start he board, I can get the data from UICR CUSTOMER registers.
but, I donot know how to ? 
 Functional description
The User Information Configuration Registers (UICRs) are</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Apr 2017 05:44:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18257/how-to-write-data-to-uicr-customer-registers" /><item><title>RE: How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/thread/70513?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 05:44:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0de8b52-3541-438e-ba2d-2ef11fc3536b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;the AT keyword is not supported, but you can do something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;volatile uint32_t user_data  __attribute__ ((section(&amp;quot;.uicr_customer&amp;quot;))) = VALUE;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then add and configure the placement of this section in the linker script:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
   ...
   UICR (r) : ORIGIN = 0x10001080, LENGTH = 0x4
}

SECTIONS
{ 
  ...
  .uicr_customer : 
  {
    KEEP(*(.uicr_customer))
  } &amp;gt; UICR

}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/thread/70512?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 15:51:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37a1de47-29ce-4ff5-846f-9942fa9dddba</guid><dc:creator>koniho</dc:creator><description>&lt;p&gt;Apparently not!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/thread/70511?ContentTypeID=1</link><pubDate>Mon, 03 Apr 2017 14:49:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28d95f70-7de4-4690-8bef-fc526ffc9f81</guid><dc:creator>koniho</dc:creator><description>&lt;p&gt;Is this compile-time approach supported by GCC?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/thread/70514?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 04:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53e0e60f-f722-4788-82a9-40d7fb4f6aed</guid><dc:creator>ligang</dc:creator><description>&lt;p&gt;unsigned long dataflash[32];&lt;/p&gt;
&lt;p&gt;void write32data(void)
{
NRF_NVMC-&amp;gt;CONFIG=2;//FOR DEL
NRF_NVMC-&amp;gt;ERASEUICR=1;
//while(NRF_NVMC-&amp;gt;READY==0);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_NVMC-&amp;gt;CONFIG=1;//FOR write
for(int tmpi=0;tmpi&amp;lt;32;tmpi++)
{
	NRF_UICR-&amp;gt;CUSTOMER[tmpi]=dataflash[tmpi];
}
NRF_NVMC-&amp;gt;ERASEUICR=0;
NRF_NVMC-&amp;gt;CONFIG=0;//FOR READ
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;void read32data(void)
{
NRF_NVMC-&amp;gt;CONFIG=0;//FOR READ
for(int tmpi=0;tmpi&amp;lt;32;tmpi++)
{
dataflash[tmpi]=NRF_UICR-&amp;gt;CUSTOMER[tmpi];
}
}&lt;/p&gt;
&lt;p&gt;I write a some code to operate the UICR. but run in s130 with BLE will error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to write data to UICR CUSTOMER registers?</title><link>https://devzone.nordicsemi.com/thread/70510?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 16:06:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:907c2c1e-081b-4b28-937e-7b4218c95819</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi, the approach for setting these registers depends on when you want to do it. I.e., at compile time or at runtime.&lt;/p&gt;
&lt;p&gt;You can for instance use the attribute keyword to declare a variable in one of the customer registers so that it gets included in the FW image (Keil)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t  user_data  __attribute__((at(NRF_UICR-&amp;gt;CUSTOMER[x])) = VALUE; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you wish to write to set the register during program execution (should be done prior to initialization of SD):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    if (NRF_UICR-&amp;gt;CUSTOMER[x] == 0xFFFFFFFF) 
    {
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
        NRF_UICR-&amp;gt;CUSTOMER[x] = VALUE;
        NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>