<?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>Write user data to NVM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112974/write-user-data-to-nvm</link><description>Hi, 
 I&amp;#39;m working with nRF5340 and would like to store my own data in the NVM (2 bytes in total). 
 I couldn&amp;#39;t figure out which flash partition is relevant for this and what is its address. I looked at the memory map ( P.20 ), but it doesn&amp;#39;t specify that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Jul 2024 07:21:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112974/write-user-data-to-nvm" /><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/494281?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2024 07:21:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d17a699b-d4f3-48ad-a15a-75a85ad4f7de</guid><dc:creator>Dekel</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112974/write-user-data-to-nvm/493898"]I recommend locking down the memory layout so the EMPTY_0 placeholder partition does not suddenly get moved or removed due to a configuration change in your project.[/quote]
&lt;p&gt;great tip! I&amp;#39;ve implemented that and it looks great, thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/493898?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 12:19:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7e7150c-688f-42ef-97dd-2487600cd55a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I don&amp;#39;t foresee any problems with this approach, but I recommend locking down the memory layout so the EMPTY_0 placeholder partition does not suddenly get moved or removed due to a configuration change in your project. You can do this by making a copy of the generated $BUILD_DIR/partitions.yml file, renaming it to pm_static.yml, and placing it in your project&amp;#39;s root directory.&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1721045690211v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Link:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html#static_and_dynamic_configuration"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html#static_and_dynamic_configuration&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can also change the &amp;#39;EMPTY_0&amp;#39; name in your pm_static file to a more descriptive name, such as &amp;#39;app_data&amp;#39;. The size and address of this partition can be found programmatically using the symbols defined in pm_config.h (included with&amp;nbsp;#include &amp;lt;pm_config.h&amp;gt;).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/493892?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 11:50:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2583b327-8044-4848-acd0-1e7c324db150</guid><dc:creator>Dekel</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112974/write-user-data-to-nvm/493812"]You can run the &amp;#39;Memory report&amp;#39; action in the vs code extension to see where in flash the storage partition is placed[/quote]
&lt;p&gt;that&amp;#39;s a nice feature, it introduced me with partition &amp;quot;EMPTY_0&amp;quot; at the end of the flash area, which works great with&amp;nbsp;&lt;span&gt;nrfx_nvmc.h!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So for code simplicity, I&amp;#39;ll continue with this library, unless you would recommend differently.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/493850?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 10:09:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b74c639d-4263-4a93-b423-2f41dd1b156f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;When using Settings, you store and load values from flash using only the settings API. The Settings subsystem builds on top of the NVS filesystem, which again builds on top of the flash drivers. nrfx_nvmc is the lowest layer.&lt;/p&gt;
&lt;p&gt;If you want to allocate a separate flash partition and manage the flash writes and erases yourself, you may&amp;nbsp;take a look at the&amp;nbsp;zephyr/samples/drivers/soc_flash_nrf sample which demonstrates how to use the zephyr flash API. Your custom flash partition can be added by creating a configuring a new static partition:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html#adding_a_static_partition"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html#adding_a_static_partition&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/493838?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 09:22:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a2d46cf-6736-48ff-8876-6662835d6202</guid><dc:creator>Dekel</dc:creator><description>&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;If I understand it correctly, I would still need to implement the get &amp;amp; set functions by myself, since settings.h is a Zephyr library. Hence, I would still need to use&amp;nbsp;&lt;span&gt;nrfx_nvmc.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Therefore, my question persists - how do I reserve a partition for this purpose and which addresses are allowed for that in nRF5340?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write user data to NVM</title><link>https://devzone.nordicsemi.com/thread/493812?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 07:17:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1e268f7-c3e2-4393-acd0-6a6f9d250e00</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Since the minimum erase unit for the flash is 4kB, you would need to reserve at least 4kB of flash even if you only&amp;nbsp;need&amp;nbsp;2 bytes of storage (actually 4 bytes, since that is the minimum write size).&lt;/p&gt;
&lt;p&gt;If you are using any of the SDK samples with wireless connectivity, it is a good chance that it is already using the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/zephyr/services/settings/index.html"&gt;Settings Subsystem&amp;nbsp;&lt;/a&gt;to manage storage of persistent application data. In that case, I would recommend you use the same module for storing your own data to allow you to use the existing storage partition in flash (You can run the &amp;#39;Memory report&amp;#39; action in the vs code extension to see where in flash the storage partition is placed).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>