<?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>nrf_fstorage help</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92660/nrf_fstorage-help</link><description>nRF52840, SDK17.1.0 SD140 
 I am attempting to write a 16 byte array to NVM. This array is initialized simply as uint8_t diaper_aes_enc_key[16];. For testing/learning of the fstorage library I attempt to write to fill this array with 7s, write this to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Oct 2022 14:31:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92660/nrf_fstorage-help" /><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/390072?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 14:31:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edfeb636-be6a-4d10-bcef-8a9a59d1b92a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;That is correct. So&amp;nbsp;when you for instance update a record, what happens is that the current record is marked as dirty (by flipping another bit in the record header from &amp;#39;1&amp;#39; to &amp;#39;0&amp;#39;), and a new record is written.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/390067?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 14:23:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f13e721-4748-4f5f-ac2f-38a88ce3bafd</guid><dc:creator>JGusler</dc:creator><description>&lt;p&gt;So with only setting File ID and record keys, is the actual memory address just set under the hood?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/390040?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 13:23:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc8b3dd9-5334-46b8-87ab-6b70ffa21896</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Yes, FDS plays nicely with the SoftDevice. In fact, all our BLE examples that support bonding use FDS, as that is the file system used by the peer manager to store bonds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/390027?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 13:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:679583c5-6e4a-4a55-9112-94fc11725b45</guid><dc:creator>JGusler</dc:creator><description>&lt;p&gt;Okie dokie, does FDS play nicely with softdevices? Thank you for all the info!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/389932?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 07:10:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd0cbf4c-43ce-4366-922f-ec345d10696c</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="JGusler"]Why would writing only flip from 1 to 0?[/quote]
&lt;p&gt;This is an inherent property of flash memory.&lt;/p&gt;
[quote user="JGusler"]Does erase set everything to 1? [/quote]
&lt;p&gt;Yes, erasing flash memory means flipping all bits to 1. On the nRF devices the smallest unit you can erase are flash pages, which are 4 kB blocks on the nRF52 series devices.&lt;/p&gt;
[quote user="JGusler"]And with erase only erasing entire pages, how would I handle only erasing the 16 bytes and not more than I want?[/quote]
&lt;p&gt;It is not possible. That is why you&amp;nbsp;often would want to use a file system (like &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_fds.html"&gt;FDS&lt;/a&gt;) to handle the complexities of this for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/389847?ContentTypeID=1</link><pubDate>Fri, 07 Oct 2022 13:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2bea83e-77e0-4ce9-a78a-54fe67e98894</guid><dc:creator>JGusler</dc:creator><description>&lt;p&gt;Why would writing only flip from 1 to 0? Does erase set everything to 1? And with erase only erasing entire pages, how would I handle only erasing the 16 bytes and not more than I want?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_fstorage help</title><link>https://devzone.nordicsemi.com/thread/389811?ContentTypeID=1</link><pubDate>Fri, 07 Oct 2022 11:51:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:215b19a3-51df-4ec2-ad1c-cf6022550bbe</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This code snippet looks correct, but I do not see the full application so there could be something outside of this that is problematic.&lt;/p&gt;
&lt;p&gt;Other than that, one important point is that writing only flip bits from &amp;#39;1&amp;#39; to &amp;#39;0&amp;#39;, so a possible explanation for the data corruption you are seeing is that the flash you are writing to has not been erased first. You could simply read and log the content of the destination address before writing to check that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>