<?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>nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15932/nrf51822-flash-read-write-sdk-v11</link><description>Hi, 
 I am currently designin one of our product with a nRF51822 QFAC included, and I need to store 17k-bytes in a non-volatile memory. 
 I am writing the firmware using SDK v11, and I had a look at the flashwrite example using NVMC.
In this example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Sep 2016 14:59:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15932/nrf51822-flash-read-write-sdk-v11" /><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60781?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2016 14:59:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:343cfe0a-c08a-4f13-83f5-d7e01827c2b5</guid><dc:creator>saiteja</dc:creator><description>&lt;p&gt;is it possible to store float array[20][20] in FDS. i am unable to read it back.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60780?ContentTypeID=1</link><pubDate>Fri, 02 Sep 2016 07:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00a1ab69-c782-4451-bd92-733a06da6fac</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;@gortok : Ok thanks, concerning the number of page that can be used, do you know the maximum value that can be set in FDS_VIRTUAL_PAGES ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60779?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 14:42:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8399fd7b-3934-406e-aaf2-8a452a0f602a</guid><dc:creator>gortok</dc:creator><description>&lt;p&gt;@Guillaume the stock example shows them writing a uint32_t value to flash; I was showing something a little more complicated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60778?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 08:55:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:500864fd-0abc-4123-8267-3b21c71e53c2</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Thanks @Einar Thorsrud, I will switch to fds ! @gortok: I had a look at your github, and I don&amp;#39;t understand the purpose of the &amp;quot;friends_data_storage&amp;quot; files, that I suppose are files that you made on your own, correct ? Why do you use gap data to store data in flash ? Is it specific to your application ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60777?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 07:09:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6d05de9-bb1c-469f-926b-89cfca650507</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;@guillaume: pstorage is older and I would not recommend it for development, as it will be deprecated soon. To quote @gortok, &amp;quot;FDS is the library to use for this going forward&amp;quot;. FDS is designed so that it can be used with a SoftDevice, and is for example used by the Peer manager, which is a replacement for the older Device manager.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60776?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 07:46:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc0b4070-957a-433e-85e6-347929a04990</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;@gortok : Thanks :) I noticed that there is another library called pstorage that look to be safer to use with a softdevice. Is another option I could consider ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60775?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 13:20:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0784781e-fd71-478d-a51e-c664fa14bed2</guid><dc:creator>gortok</dc:creator><description>&lt;p&gt;@guillaume not for what you need. After the softdevice is flashed, you have 112KB left over on the device (if you&amp;#39;re using the xxAC variant), and if you want to use the Dual bank DFU, you need double your application space to update the application firmware.  You can use Single Bank. Either way, you have more than enough room to flash 17Kb using the nordic FDS library.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60774?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 11:54:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a512c8c5-fb03-45b3-b6a4-203c4e78a4de</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Ok thanks gortok, I&amp;#39;ll have a look on it. For I am just trying to figure out if I need some external flash IC on my PCB or not :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Flash read/write SDK v11</title><link>https://devzone.nordicsemi.com/thread/60773?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 20:46:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:159c5e78-049a-45dc-bdcd-f17609ae9084</guid><dc:creator>gortok</dc:creator><description>&lt;p&gt;The answer to both your questions is &amp;quot;yes&amp;quot;. Nordic has said that the Flash Data Storage (FDS) library is the library to use for this going forward.&lt;/p&gt;
&lt;p&gt;I have a sample project on Github that shows how to use FDS to do this.&lt;/p&gt;
&lt;p&gt;For SDK 11:&lt;/p&gt;
&lt;p&gt;We statically allocate storage while the device is in use.  so for whatever your use, make sure your container is allocated:&lt;/p&gt;
&lt;p&gt;###For Writing&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void save_friends(friends_list_t * friends_list) {
	static fds_record_chunk_t chunk;

	fds_record_t record;
  record.file_id = DATA_STORAGE_TYPE_ID;
  record.key = DATA_STORAGE_INSTANCE_ID;

	chunk.p_data = friends_list;
  NRF_LOG_PRINTF(&amp;quot;size should be storing for max_length: %u\n&amp;quot;, sizeof(friends_list_t));
	uint16_t max_length =  sizeof(friends_list_t);
	uint16_t length_words = max_length / 4;
	chunk.length_words = length_words; //number of 4-byte word chunks of color_friends_t
	uint32_t err_code;
  record.data.p_chunks = &amp;amp;chunk;
  record.data.num_chunks = 1;
  err_code = fds_record_update(&amp;amp;friend_list_descriptor, &amp;amp;record);
  NRF_LOG_PRINTF(&amp;quot;UPDATE FRIENDS: max_length: %u, length_words: %u, Error Code was: %u\n&amp;quot;, max_length, length_words, err_code);
  APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;For Reading&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;void load_friends(friends_list_t * friends_to_load)
{
  static fds_find_token_t tok;
  static fds_flash_record_t record;
  while(fds_record_find(DATA_STORAGE_TYPE_ID, DATA_STORAGE_INSTANCE_ID, &amp;amp;friend_list_descriptor, &amp;amp;tok) == NRF_SUCCESS) {
    fds_record_open(&amp;amp;friend_list_descriptor, &amp;amp;record);
    memcpy(friends_to_load, record.p_data, sizeof(friends_list_t));
    NRF_LOG_PRINTF(&amp;quot;friends to load, num of friends is: %u\n&amp;quot;, friends_to_load-&amp;gt;num_of_friends);
    fds_record_close(&amp;amp;friend_list_descriptor);
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have branches for SDK 10 and SDK 11:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Jewelbots/nordic-flash-data-storage/tree/SDK11_upgrade"&gt;github.com/.../SDK11_upgrade&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are a few issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Sometimes the write operation can interfere with the softdevice and cause the device to reset.  I haven&amp;#39;t yet solved this problem.&lt;/li&gt;
&lt;li&gt;fds_update did not work in SDK10; I haven&amp;#39;t yet checked to see if it works in SDK 11, but the above code assumes they fixed the probem in SDK 11. If not, then check the SDK 10 branch in that repo to see how I worked around it.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>