<?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>NVS write succeeds, but read fails intermittently after flash erase on first boot (nRF52840, NCS v2.6.0)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123453/nvs-write-succeeds-but-read-fails-intermittently-after-flash-erase-on-first-boot-nrf52840-ncs-v2-6-0</link><description>Hi Nordic team, 
 I&amp;#39;m using nRF52840 with nRF Connect SDK v2.6.0 and using NVS to store RSA key material on flash. The goal is to persistently store a generated RSA key pair and retrieve it across reboots. 
 Expected Behavior: 
 
 
 On first boot after</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Aug 2025 07:30:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123453/nvs-write-succeeds-but-read-fails-intermittently-after-flash-erase-on-first-boot-nrf52840-ncs-v2-6-0" /><item><title>RE: NVS write succeeds, but read fails intermittently after flash erase on first boot (nRF52840, NCS v2.6.0)</title><link>https://devzone.nordicsemi.com/thread/545316?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 07:30:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4472cd9-3831-4e19-b505-d046e51db22f</guid><dc:creator>sai varma datla</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p data-start="54" data-end="343"&gt;Yes, exactly &amp;mdash; BLE and Zigbee can both use &lt;code data-start="97" data-end="115"&gt;settings_storage&lt;/code&gt;, which can cause NVS conflicts.&lt;br data-start="147" data-end="150" /&gt; We fixed it by defining a &lt;strong data-start="176" data-end="199"&gt;static flash layout&lt;/strong&gt; in &lt;code data-start="203" data-end="218" data-is-only-node=""&gt;pm_static.yml&lt;/code&gt; with a separate NVS partition for our app data, keeping it isolated from BLE/Zigbee settings and preventing read failures.&lt;/p&gt;
&lt;p data-start="345" data-end="406"&gt;Thanks for pointing this out and for the helpful reference!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write succeeds, but read fails intermittently after flash erase on first boot (nRF52840, NCS v2.6.0)</title><link>https://devzone.nordicsemi.com/thread/545043?ContentTypeID=1</link><pubDate>Fri, 08 Aug 2025 11:16:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ca65570-2f44-40b6-975e-afc93882524d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Dalta,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am not very experienced with Zigbee but it seems like it can also use the default storage partition like BLE and can cause issues over time. The safest approach is to define a second, dedicated flash partition for your own NVS data. This is done by adding a custom_storage entry to partitions.yml and mounting it separately in your code. This keeps the application’s flash writes completely separate from the settings partition used by BLE and Zigbee, eliminating contention and improving stability, especially after a flash erase.&lt;/p&gt;
&lt;p&gt;Lot of these are discussed in the devzone discussions&amp;nbsp;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/110879/flash-partitioning"&gt;Flash partitionin&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/102829/wrong-read-from-settings_storage-flash-in-nrf52840-and-nrf-connect-sdk-2-4-1"&gt;Wrong read from settings_storage flash in nRF52840 and nRF Connect SDK 2.4.1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write succeeds, but read fails intermittently after flash erase on first boot (nRF52840, NCS v2.6.0)</title><link>https://devzone.nordicsemi.com/thread/544757?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2025 10:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9b0757f-18b1-47f5-bf24-65f7ffd9cb14</guid><dc:creator>sai varma datla</dc:creator><description>&lt;p data-start="183" data-end="201"&gt;Hi Susheel Nuguru,&lt;/p&gt;
&lt;p data-start="203" data-end="231"&gt;Thank you for your response.&lt;/p&gt;
&lt;p data-start="233" data-end="528"&gt;We have observed that there&amp;#39;s only &lt;strong data-start="268" data-end="293"&gt;one storage partition&lt;/strong&gt; being used in our project, and it&amp;#39;s currently being shared by &lt;strong data-start="356" data-end="385"&gt;BLE (settings) and Zigbee&lt;/strong&gt;. We suspect this overlap might be contributing to the intermittent &lt;code data-start="453" data-end="465"&gt;nvs_read()&lt;/code&gt; failures, especially during the early boots after flash erase.&lt;/p&gt;
&lt;p data-start="530" data-end="939"&gt;Additionally, in our code, we are calling &lt;code data-start="572" data-end="589"&gt;bt_enable(NULL)&lt;/code&gt; &lt;strong data-start="590" data-end="600"&gt;before&lt;/strong&gt; initializing our storage (i.e., before mounting the &lt;code data-start="653" data-end="661"&gt;nvs_fs&lt;/code&gt;). While debugging, we also noticed in the NCS source code that the Bluetooth stack might also be using the same storage partition internally (possibly via the settings subsystem). This could lead to conflicts or data races when multiple components access the same flash region.&lt;/p&gt;
&lt;h3 data-start="946" data-end="973"&gt;Follow-up Questions:&lt;/h3&gt;
&lt;ol data-start="975" data-end="1711"&gt;
&lt;li data-start="975" data-end="1141"&gt;
&lt;p data-start="978" data-end="1141"&gt;&lt;strong data-start="978" data-end="1055"&gt;Is there a recommended way to create a dedicated/custom storage partition&lt;/strong&gt; specifically for application data, separate from the one used by BLE/Zigbee settings?&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1142" data-end="1269"&gt;
&lt;p data-start="1145" data-end="1269"&gt;Are there known conflicts or best practices when multiple subsystems (like BLE and Zigbee) share the same storage partition?&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1386" data-end="1518"&gt;
&lt;p data-start="1389" data-end="1518"&gt;If partitioning is not an option, are there any other known resolutions or sync strategies to ensure data stability across boots?&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1519" data-end="1711"&gt;
&lt;p data-start="1522" data-end="1711"&gt;&lt;strong data-start="1522" data-end="1656"&gt;If we need to create a static (custom) storage partition, could you please provide the correct steps to define and use it properly&lt;/strong&gt; (e.g., using &lt;code data-start="1670" data-end="1686"&gt;partitions.yml&lt;/code&gt;, &lt;code data-start="1688" data-end="1696"&gt;nvs_fs&lt;/code&gt;, &lt;code data-start="1698" data-end="1703"&gt;dts&lt;/code&gt;, etc.)?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-start="1713" data-end="1838"&gt;We&amp;rsquo;re using the &lt;strong data-start="1729" data-end="1741"&gt;nRF52840&lt;/strong&gt; with &lt;strong data-start="1747" data-end="1761"&gt;NCS v2.6.0&lt;/strong&gt;, and appreciate any guidance on how to resolve this storage overlap cleanly.&lt;/p&gt;
&lt;p data-start="1840" data-end="1870"&gt;Thanks again for your support.&lt;/p&gt;
&lt;p data-start="1872" data-end="1897"&gt;Best regards,&lt;br data-start="1885" data-end="1888" /&gt; Sai Varma&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write succeeds, but read fails intermittently after flash erase on first boot (nRF52840, NCS v2.6.0)</title><link>https://devzone.nordicsemi.com/thread/544722?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2025 08:03:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e091f5f-fcd4-4bad-a216-2b1a2f4d5e22</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Sai Varma,&lt;/p&gt;
&lt;p&gt;If I understand correctly what you mean by nvs_read&amp;nbsp;&lt;span&gt;intermittently fails after write and reboot is that after couple of reboots the nvs_read succeeds sometimes? If that is the case, then the nvs_write was successful and there is some issue with the read sometimes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is it possible for you to provide me a minimalistic project on nRF52840DK so that I can try to understand the issue better?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>