<?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>Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19703/is-it-possible-to-continuously-log-data-to-flash-memory</link><description>I&amp;#39;m not sure if this question has been asked here before, but I couldnt find an existing answer... 
 I know that flash memory only has a relatively limited number of write / erase cycles. 
 For the nRF51 this is 20,000. 
 But from what I understand</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 19 Feb 2017 17:15:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19703/is-it-possible-to-continuously-log-data-to-flash-memory" /><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76658?ContentTypeID=1</link><pubDate>Sun, 19 Feb 2017 17:15:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922d9144-3175-470a-a80d-d58ebf4b30d6</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Yes, using bits is a common approach&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76657?ContentTypeID=1</link><pubDate>Sun, 19 Feb 2017 00:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1347d2ff-056a-4653-a7b1-8bad7e208257</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;I don&amp;#39;t think my data can ever be zero for the entire block I&amp;#39;m writing, so an allocation table wouldn&amp;#39;t be necessary in this case, and would use up space into which I could log data.&lt;/p&gt;
&lt;p&gt;BTW.
If I did want to use an allocation table..
Is this done by using individual bits in each byte, otherwise if the chunks of data (struct) I&amp;#39;m writing was fairly small, (which it may initially be), the space taken by the allocation table could be significant.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76656?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2017 07:29:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd189e75-d4f3-4c4e-a836-6ecc59346112</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Rather than restrict the data to not contain (all) FF, a common approach is to have an &amp;quot;allocation table&amp;quot; which shows what blocks have been used -so you just scan through the table to find the next &amp;quot;free&amp;quot; block...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76660?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 22:28:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03a12a2b-4954-4bd2-93a2-f0ed60843964</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;BTW&lt;/p&gt;
&lt;p&gt;Looking at the spec for the nRF51 it looks like the Flash page size is 1024 bytes.&lt;/p&gt;
&lt;p&gt;If so thats quite good as it will not loose a large chunk of the circular buffer when I clear a page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76655?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 20:35:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f34b567f-0c86-4696-9c6e-d1fa77e44c57</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;I know this is a common problem, so I will see if I can find a generic solution, and write code to use that solution using the API which controls writing and erasing of flash.&lt;/p&gt;
&lt;p&gt;e.g.
If an erased location reads back as 0xff I can use this to find the next available location after the code starts, then after that store the location of that address in RAM.&lt;/p&gt;
&lt;p&gt;I just need to make sure that the data struct I am writing, cant contain 0xff in the first byte, or perhaps cant contain 0xff for all bytes.
i dont think it would be a big problem to ensure that the whole struct was not 0xff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76663?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 20:30:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c88a310d-fe4c-4382-8120-0989835328b4</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;I looked at the low level API, and could use that, with a suitable page erase strategy.&lt;/p&gt;
&lt;p&gt;I think after a page of flash is erased the values read back as 0xff, so I should be able to use that as an indicator of the next available location, as long as the first byte in my data struct can never be 0xff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76654?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 13:21:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5dfa9316-e0bd-49e0-98b3-7fcbddaeab38</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Yes, it is true that the thing which &amp;quot;wears&amp;quot; Flash (any Flash) is the erase.&lt;/p&gt;
&lt;p&gt;So it is quite common to have a method along the lines you suggest; you might have a table - like the File Allocation Table in the FAT disk format - which shows where the next &amp;quot;free&amp;quot; space it; and, instead of actually erasing an entry, you just mark it as &amp;quot;deleted&amp;quot; ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76662?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 11:59:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc494fc1-716a-4aa6-b643-46574375ad42</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, then I agree that the FDS module might not be the best fit. I think it might be better to look at the fstorage library instead that is used by the FDS library to perform the actual flash operations.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76661?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 11:57:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd5535da-f8d0-4656-8db9-de12719f0af2</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;I have used the FDS, but only for small structs of data, containning settings used by the application.&lt;/p&gt;
&lt;p&gt;I need to log an 8 byte struct once per minute, so that the total storage will be a circular buffer of 8000 samples.&lt;/p&gt;
&lt;p&gt;And FDS didnt look like it was designed for this sort if operation.&lt;/p&gt;
&lt;p&gt;Howver I will analyse the examples on github and see if anything looks like my uze case,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to continuously log data to flash memory?</title><link>https://devzone.nordicsemi.com/thread/76659?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 10:42:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab7998af-d2aa-4335-82bd-0c91edda9afa</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Roger,&lt;/p&gt;
&lt;p&gt;I think that the Flash Data Storage(FDS) library covers the use-case that you&amp;#39;re describing. The library is described on &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/lib_fds.html?cp=4_0_1_3_37"&gt;this&lt;/a&gt; page on our Infocenter.&lt;/p&gt;
&lt;p&gt;There are some examples on our GitHub site, found &lt;a href="https://github.com/NordicSemiconductor/nRF5-flash-storage-examples"&gt;here&lt;/a&gt;. They are, however, based on SKD v11.0.0, but it should not be a big task to port them to the latest and greatest SDK v12.2.0.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>