<?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 UICR at runtime in the nRF5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122150/how-to-write-uicr-at-runtime-in-the-nrf5340</link><description>Hi, 
 I would like to know how to write to the UICR OTP (0x00FF8300) in the application core of the nRF5340 at runtime. This procedure should be performed once at the factory via BLE (not possible to use the programmer); afterwards, the firmware should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Jun 2025 22:18:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122150/how-to-write-uicr-at-runtime-in-the-nrf5340" /><item><title>RE: How to write UICR at runtime in the nRF5340</title><link>https://devzone.nordicsemi.com/thread/538576?ContentTypeID=1</link><pubDate>Mon, 09 Jun 2025 22:18:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e63d649-8730-46f4-9374-b910332c0ba2</guid><dc:creator>PabloL</dc:creator><description>&lt;p&gt;Sorry, my fault!&lt;/p&gt;
&lt;p&gt;This is the corrected code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void UICR_write(uint32_t data)
{
    NRF_NVMC_Type* nvmc;

    nvmc = NRF_NVMC;

    // Enable write mode
    nvmc-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);
    __ISB();
    __DSB();

    // Write the value
    *(uint32_t *)TARGET_ADDRESS = data;

    // Wait until write is finished
    while (!nrf_nvmc_ready_check(nvmc)) {}
    
    // Disable write mode
    nvmc-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren;
    __ISB();
    __DSB();

    // Reset to apply changes
    sys_reboot(SYS_REBOOT_COLD);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>