<?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>Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55680/storing-data-to-flash-memory</link><description>Hi 
 I am using the Nordic NRF52840_dk with SDK 16. 
 
 I want to store data to flash memory with Ble and uart enabled. I am using a external UART peripheral to receive data which, I then parse and broadcast via a ble advertisement. 
 However, I wish</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Jan 2020 13:19:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55680/storing-data-to-flash-memory" /><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/227681?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2020 13:19:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f72849a-7d8b-475b-80e7-2771d6f5792b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Desc is the descriptor which is used to find and store values in records. config is the variable (fds_flash_record_t) that holds the actual flash data. You can check the definitions of these variable types in fds.h for an explanation.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Have you seen the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds_usage.html&amp;amp;cp=7_1_3_56_3"&gt;usage section&lt;/a&gt;&amp;nbsp;on infocenter? It contains some pointers on how to use the records. So check out the variable types and this guide.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/227539?ContentTypeID=1</link><pubDate>Sun, 05 Jan 2020 13:21:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3300b339-318f-4dfc-9aae-734c748ca418</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Im using segger.&lt;/p&gt;
&lt;p&gt;On the line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  rc = fds_record_open(&amp;amp;desc, &amp;amp;config);//Read data&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;How do I read the last entry. I presume the config that is in the flash is the default dummy one.&lt;/p&gt;
&lt;p&gt;So my question is what is desc? Is this the specfic instance that is read?&lt;/p&gt;
&lt;p&gt;Because I want to call a function that I can read the last record from. I will later need to read all the data. But I am thinking of doing this in a for loop from the first entry to the last.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226377?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 13:05:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae73b182-6da5-4760-b1e2-3affcfb77208</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If you set a breakpoint and then resume,&amp;nbsp; the softdevice will assert. That is fine, you just need to reset.&lt;/p&gt;
&lt;p&gt;Just set a breakpoint at the line memcpy, and right click config.p_data and click &amp;quot;add to watch&amp;quot;. What this button is called depends on your IDE.&lt;/p&gt;
&lt;p&gt;If you are not able to see the content of the pointer, then you need to disable optimization in your project.If you are not sure how to do that, let me know what IDE you are using.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226351?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 11:40:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd520c25-2ea2-4148-bf71-1f7ce06664f0</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;When I place a breakpoint on&amp;nbsp;&amp;nbsp;memcpy(&amp;amp;m_sensor_cfg, config.p_data, sizeof(configuration_t));&lt;/p&gt;
&lt;p&gt;I run over it and, it goes to NRF_BREAKPOINT_COND.&lt;/p&gt;
&lt;p&gt;So I am not sure how to test it.&lt;/p&gt;
&lt;p&gt;I presume I am writing the information incorrectly and reading it incorrectly.&lt;/p&gt;
&lt;p&gt;Given the aforementioned line of code should print out &amp;quot;sensor&amp;quot; as this is what I believe I write to the configuration file.&lt;/p&gt;
&lt;p&gt;However, I don&amp;#39;t want to read the configuration file. I want to read the latest data.&lt;/p&gt;
&lt;p&gt;But, I can&amp;#39;t find an example of where to do that in the sdk example code. Or the documentation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226341?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 10:52:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0983afc9-943b-4a9b-a9b9-098f7b8e6e8c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What&amp;nbsp;does p_data look like in the flash_storage_read_data() function right before you copy it over to the m_sensor_cfg?&lt;/p&gt;
&lt;p&gt;Try to set a breakpoint and watch that data.&lt;/p&gt;
&lt;p&gt;Did you wait for the write complete event before you read it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226310?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 09:20:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd5464e2-96b4-40ac-a500-add93db52642</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;That is the line of code that should pull the data. I want that line of code to output the latest data I have entered into my flash storage.&lt;/p&gt;
&lt;p&gt;The line of code you highlighted always prints &amp;quot;Reading data dummy&amp;quot; even though the data I am pointing at in the line of code is the m_sensor_cfg. This has a device name set to &amp;quot;Sensor&amp;quot; not &amp;quot;dummy&amp;quot; thus my confusion.&lt;/p&gt;
&lt;p&gt;I am writing a new entry via my flash_storage_write_data function. This is the data I wish to read (latest).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226309?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 09:16:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99682c47-5af1-4ea0-8bbc-bcf94af297bf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what to read out of your snippets. Is it the lines in the log saying &amp;quot;reading data dummy&amp;quot; that you refer to?&lt;/p&gt;
&lt;p&gt;Beause the only place I can see that you print that is from the line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_LOG_INFO(&amp;quot;Reading data %s.&amp;quot;, m_sensor_cfg.device_name);//Print out the configurations bootcount member variable&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What do you expect it to say? Where does &amp;quot;dummy&amp;quot; come from, and where do you update it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226189?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 14:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c79b30af-ae10-45be-b632-379b87b56c0f</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;I think it might be because I am always reading the same data? Which, is set by the code before mine. The dummy code. Therefore for reading the data how do I point it to the latest data inside of the flash storage?&lt;/p&gt;
&lt;p&gt;Also are multiple configurations allowed in the fds_example.h?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226173?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 14:12:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42b96a85-41db-4dfa-9790-26f6c0b9b8dd</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Ok thanks I won&amp;#39;t call fds_gs too often,.&lt;/p&gt;
&lt;p&gt;I still have the issue of my code not reading from the correct location.&lt;/p&gt;
&lt;p&gt;I have setup two data configurations. One is the dummy it is unchanged.&lt;/p&gt;
&lt;p&gt;The other is custom see below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Sensor configuration data. */
static configuration_t_sensor m_sensor_cfg =
{
    .config1_on  = false,
    .config2_on  = true,
    .boot_count  = 0x0,
    .device_name = &amp;quot;sensor&amp;quot;,
    .count_id    = 0,
    .t1_data     = 0,
    .t2_data     = 0,
    .t3_data     = 0,
    .p1_data     = 0,
    .p2_data     = 0,
};

/* A record containing dummy configuration data. */
static fds_record_t const m_sensor_record =
{
    .file_id           = CONFIG_FILE,
    .key               = CONFIG_REC_KEY,
    .data.p_data       = &amp;amp;m_sensor_cfg,
    /* The length of a record is always expressed in 4-byte units (words). */
    .data.length_words = (sizeof(m_sensor_cfg) + 3) / sizeof(uint32_t),
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When I print my data to the RTT view it always reads the dummy data.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;NRF_LOG_INFO(&amp;quot;Reading data %s.&amp;quot;, m_sensor_cfg.device_name);&lt;/p&gt;
&lt;p&gt;I am going to assume this is a configuration / setup issue.&lt;/p&gt;
&lt;p&gt;Also when running the code and looping a function to add. I fill up the flash very fast.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;0&amp;gt; &amp;lt;info&amp;gt; app: Received string: &amp;quot;1,1191,1,1172
00&amp;gt; &amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T1 is:&amp;quot;1191&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T2 is:&amp;quot;1172&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: Reading data dummy.
00&amp;gt; &amp;lt;info&amp;gt; app: Data added successfully
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_WRITE received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Record ID:  0x0087
00&amp;gt; &amp;lt;info&amp;gt; app: File ID:  0x8010
00&amp;gt; &amp;lt;info&amp;gt; app: Record key:  0x7010
00&amp;gt; &amp;lt;info&amp;gt; app: Received string: &amp;quot;1,1191,1,1172
00&amp;gt; &amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T1 is:&amp;quot;1191&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T2 is:&amp;quot;1172&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: Reading data dummy.
00&amp;gt; &amp;lt;info&amp;gt; app: Data added successfully
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_WRITE received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Record ID:  0x0088
00&amp;gt; &amp;lt;info&amp;gt; app: File ID:  0x8010
00&amp;gt; &amp;lt;info&amp;gt; app: Record key:  0x7010
00&amp;gt; &amp;lt;info&amp;gt; app: Received string: &amp;quot;1,1191,1,1172
00&amp;gt; &amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T1 is:&amp;quot;1191&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: T2 is:&amp;quot;1172&amp;quot;
00&amp;gt; &amp;lt;info&amp;gt; app: Reading data dummy.
00&amp;gt; &amp;lt;info&amp;gt; app: No space in flash, delete some records to update the config file.
00&amp;gt; &amp;lt;info&amp;gt; app: Received string: &amp;quot;1,1191,1,1172
00&amp;gt; &amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note the t1 and t2 data are coming in from a UART this is the data I wish to store.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226158?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 13:33:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ab8616b-37bf-426e-8672-42bc7423b7da</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Sorry, I forgot to comment your last post.&lt;/p&gt;
&lt;p&gt;Well. The easiest would probably to erase the entire flash if you end up with a lot of records. The easiest way is to use &lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools/Download" rel="noopener noreferrer" target="_blank"&gt;Nordic Command Line Tools&lt;/a&gt;, and the command &amp;quot;nrfjprog -e&amp;quot;. This will delete everything on the chip.&lt;/p&gt;
&lt;p&gt;However, You can see from your log that you have 100 dirty records, and only 4 valid records. This means that you can run a garbage collection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Whenever you either update a record or delete a record, it is marked for deletion. This is what we call a dirty record. The reason it isn&amp;#39;t deleted and freeing up the space immediately is because of the nature of the flash. You need to erase large chunks at once,&amp;nbsp; and you can only write one time to a specific location once between deleting it again (in fact, you can only write 1&amp;#39;s to 0&amp;#39;s in a flash, before erasing it, which will reset it to 1&amp;#39;s. This is why an empty flash is always 0xFF&amp;#39;s).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, when either fds_record_write or fds_record_update returns NRF_ERROR_NO_MEM, you need to run a garbage collection by calling &lt;strong&gt;fds_gc()&lt;/strong&gt;. This is a complex call, moving the records around to free space (one flash page is always reserved for this in FDS), and deleting the old pages, so that it has room for new records. Remember to wait for the callback for this call before you try to read or write something else.&lt;/p&gt;
&lt;p&gt;The event that you should add to your fds_event handler is called&amp;nbsp;FDS_EVT_GC. Check that it returned with&amp;nbsp;p_evt-&amp;gt;result == NRF_SUCCESS before setting a flag saying it is ok to continue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, don&amp;#39;t fall for the temptation of running fds_gc() on every startup. This will beat up the flash. The flash on the nRFs are guaranteeing 10000 flash erase/write cycles. If you run fds_gc() on every startup, this will be limited to 10000 resets.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The flash will not stop working after 10 001 cycles, but this is what we can say for sure that will work.&lt;/p&gt;
&lt;p&gt;It is not unusual that it will work for 40-50 000 cycles, or even 100 000 cycles, but still, there is no need to beat up the flash by running an fds_gc() before it is necessary.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226151?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 13:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2c72674-5d70-4b35-8631-76dce22c4ae5</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Thanks for the Edvin,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve written that in now.&lt;/p&gt;
&lt;p&gt;But I cant test it because my flash is full.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; &amp;lt;info&amp;gt; app: Initializing fds...
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_INIT received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Found 4 valid records.
00&amp;gt; &amp;lt;info&amp;gt; app: Found 100 dirty records (ready to be garbage collected).
00&amp;gt; &amp;lt;info&amp;gt; app: Writing config file...
00&amp;gt; &amp;lt;info&amp;gt; app: No space in flash, delete some records to update the config file.
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_DEL_FILE received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: No space in flash, delete some records to update the config file.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Therefore, I need to delete the data. How do I delete all of the data?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tried&amp;nbsp;fds_file_delete(&amp;amp;desc); which does not work.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226148?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 13:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3e06af7-c099-4938-83de-0cf844c5fa22</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I didn&amp;#39;t understand what exactly you are trying to tell me, but I guess you are not reading the same as you are writing?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ThomasMorris"]If so is there a statement that says something like wait till fds ready.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Yes.&lt;/p&gt;
&lt;p&gt;Do you have an event handler for your FDS instance? You probably have a call like this somewhere:&lt;/p&gt;
&lt;p&gt;fds_register(fds_evt_handler);&lt;/p&gt;
&lt;p&gt;If so, fds_evt_handler is your fds callback function.&lt;/p&gt;
&lt;p&gt;What you need to do is to wait after you have changed any of the flash content. You can do so by using a flag:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//Top of main.c

volatile bool fds_write_complete_flag = false;


static void fds_evt_handler(fds_evt_t const * p_evt)
{
    if (p_evt-&amp;gt;result == NRF_SUCCESS)
    {
        NRF_LOG_GREEN(&amp;quot;Event: %s received (NRF_SUCCESS)&amp;quot;,
                      fds_evt_str[p_evt-&amp;gt;id]);
    }
    else
    {
        NRF_LOG_GREEN(&amp;quot;Event: %s received (%s)&amp;quot;,
                      fds_evt_str[p_evt-&amp;gt;id],
                      fds_err_str(p_evt-&amp;gt;result));
    }

    switch (p_evt-&amp;gt;id)
    {
        case FDS_EVT_INIT:
            if (p_evt-&amp;gt;result == NRF_SUCCESS)
            {
                m_fds_initialized = true;
            }
            break;

        case FDS_EVT_WRITE:
        {
            if (p_evt-&amp;gt;result == NRF_SUCCESS)
            {
                NRF_LOG_INFO(&amp;quot;Record ID:\t0x%04x&amp;quot;,  p_evt-&amp;gt;write.record_id);
                NRF_LOG_INFO(&amp;quot;File ID:\t0x%04x&amp;quot;,    p_evt-&amp;gt;write.file_id);
                NRF_LOG_INFO(&amp;quot;Record key:\t0x%04x&amp;quot;, p_evt-&amp;gt;write.record_key);
                fds_write_complete_flag = true;
            }
        } break;

        case FDS_EVT_DEL_RECORD:
        {
            if (p_evt-&amp;gt;result == NRF_SUCCESS)
            {
                NRF_LOG_INFO(&amp;quot;Record ID:\t0x%04x&amp;quot;,  p_evt-&amp;gt;del.record_id);
                NRF_LOG_INFO(&amp;quot;File ID:\t0x%04x&amp;quot;,    p_evt-&amp;gt;del.file_id);
                NRF_LOG_INFO(&amp;quot;Record key:\t0x%04x&amp;quot;, p_evt-&amp;gt;del.record_key);
            }
            m_delete_all.pending = false;
        } break;

        default:
            break;
    }
}

int main(void)
{
    (void) fds_register(fds_evt_handler);
    
    flash_storage_read_data();
    flash_storage_write_data(00,00,00,00,00,00,00,00,00);//Write the information to the flash storage
    while (fds_write_complete_flag == false)
    {
        // Wait...
    }
    fds_write_complete_flag = false;
    flash_storage_read_data();
    
    &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;See how I use the FDS_EVT_WRITE event to set the fds_write_complete_flag to true, and how I wait in the main() function for this event to set the flag before I read it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226133?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 12:18:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71710af4-8ca6-4c95-b29b-1444d6eaa635</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Also when I run the write code in a loop i quickly ran out of space.&lt;/p&gt;
&lt;p&gt;It comes up with :No space in flash, delete some records to update the config file.&lt;/p&gt;
&lt;p&gt;How do I delete the entrants? ( All of them)&lt;/p&gt;
&lt;p&gt;I presume it has something to do with fds_record_delete within the fds.c code.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226132?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 12:09:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4db6d628-8198-4cb8-a782-fc696c2cc42b</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Cheers Edvin, I&amp;#39;ve decided not to use CLI.&lt;/p&gt;
&lt;p&gt;I want to be able to store data and then read it.&lt;/p&gt;
&lt;p&gt;At the moment I have some code that adds an entry to the flash storage and then reads it.&lt;/p&gt;
&lt;p&gt;This is called after the dummy entry has been added.&lt;pre class="ui-code" data-mode="c_cpp"&gt;flash_storage_read_data();
flash_storage_write_data(00,00,00,00,00,00,00,00,00);//Write the information to the flash storage
flash_storage_read_data();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;These functions are written as below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void flash_storage_write_data(int count, int T1_value,int T2_value,
                                       int t3_value_1,int t3_value_2, int p1_value_1, int p1_value_2,
                                       int p2_value_1,int p2_value_2){
    ret_code_t rc;
    fds_record_desc_t desc = {0};
    //Need to modify the sensor record here
    rc = fds_record_write(&amp;amp;desc, &amp;amp;m_sensor_record);//Write data to the sensor record
        if ((rc != NRF_SUCCESS) &amp;amp;&amp;amp; (rc == FDS_ERR_NO_SPACE_IN_FLASH))
        {
            NRF_LOG_INFO(&amp;quot;No space in flash, delete some records to update the config file.&amp;quot;);
        }
        else
        {
            APP_ERROR_CHECK(rc);
            NRF_LOG_INFO(&amp;quot;Data added successfully&amp;quot;);
        }
}

static void flash_storage_read_data()//Function to read the data from the flash storage
{
    ret_code_t rc;
    fds_record_desc_t desc = {0};
    fds_find_token_t  tok  = {0};

    rc = fds_record_find(CONFIG_FILE, CONFIG_REC_KEY, &amp;amp;desc, &amp;amp;tok);

    if (rc == NRF_SUCCESS)
    {
        /* A config file is in flash. Let&amp;#39;s update it. */
        fds_flash_record_t config = {0};

        /* Open the record and read its contents. */
        rc = fds_record_open(&amp;amp;desc, &amp;amp;config);//NEed to ensure it opens sensor config
        APP_ERROR_CHECK(rc);

        /* Copy the configuration from flash into m_sensor_cfg. */
        memcpy(&amp;amp;m_sensor_cfg, config.p_data, sizeof(configuration_t_sensor));

        NRF_LOG_INFO(&amp;quot;Reading data %s.&amp;quot;, m_sensor_cfg.device_name);//Print out the configurations bootcount member variable

        /* Update boot count. */
        m_dummy_cfg.boot_count++;

        /* Close the record when done reading. */
        rc = fds_record_close(&amp;amp;desc);
        APP_ERROR_CHECK(rc);
     }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have defined my own configuration in the fds_example.h to contain sensor data information:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//Sensor Config data
typedef struct
{
    uint32_t boot_count;
    char     device_name[16];
    bool     config1_on;
    bool     config2_on;
    
    int count_id;
    int t1_data;
    int t2_data;
    int t3_data;
    int p1_data;
    int p2_data;
}configuration_t_sensor;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, when I run my code I receive:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;00&amp;gt; &amp;lt;info&amp;gt; app: UART example started.
00&amp;gt; &amp;lt;info&amp;gt; app: Initializing fds...
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_INIT received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Found 54 valid records.
00&amp;gt; &amp;lt;info&amp;gt; app: Found 18 dirty records (ready to be garbage collected).
00&amp;gt; &amp;lt;info&amp;gt; app: Config file found, updating boot count to 8.
00&amp;gt; &amp;lt;info&amp;gt; app: Reading data dummy.
00&amp;gt; &amp;lt;info&amp;gt; app: Data added successfully
00&amp;gt; &amp;lt;info&amp;gt; app: Reading data dummy.
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_UPDATE received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Event: FDS_EVT_WRITE received (NRF_SUCCESS)
00&amp;gt; &amp;lt;info&amp;gt; app: Record ID:  0x004C
00&amp;gt; &amp;lt;info&amp;gt; app: File ID:  0x8010
00&amp;gt; &amp;lt;info&amp;gt; app: Record key:  0x7010&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Even though I have configured my sensor data&amp;nbsp; configuration to be:&lt;pre class="ui-code" data-mode="c_cpp"&gt;static configuration_t_sensor m_sensor_cfg =
{
    .config1_on  = false,
    .config2_on  = true,
    .boot_count  = 0x0,
    .device_name = &amp;quot;Sensor&amp;quot;,
    .count_id    = 0,//Int to to be passed in
    .t1_data     = 0,//Int to to be passed in
    .t2_data     = 0,//Int to to be passed in
    .t3_data     = 0,//Int to to be passed in
    .p1_data     = 0,//Int to to be passed in
    .p2_data     = 0,//Int to to be passed in
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am not sure why this is. Could it have something to do with the flash storage taking a long time as you stated? If so is there a statement that says something like wait till fds ready. However, surely it should read the configuration file I have selected.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226126?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 11:53:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5bb64da-0e26-4fb5-9da7-5559ff7f7b83</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;You can store data to flash without the CLI library. What you can do is to look at what the different CLI commands. Unfortunately, it is a bit tricky to trace what these commands to, which is why I find it a bit unfortunately that the FDS examples use this.&lt;/p&gt;
&lt;p&gt;Basically, you can use UART to send a string of data to the nRF, then use the fds_record_write() or fds_record_update() to save this data.&lt;/p&gt;
&lt;p&gt;If you want to dig into why it crashes with &amp;quot;fatal error&amp;quot;, this means that one of your APP_ERROR_CHECK(err_code) receives an err_code != 0. If you want to find out which one, I suggest that you define DEBUG in your preprocessor defines (let me know if you are not sure how to do that, and what SDK version you use, and what IDE you use).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Remember that if you write or update a record using fds_record_write/update(), then you need to wait for the FDS callback before you can read it. This is typically not a problem in the CLI case, since the time you use to type the different commands is very long compared to the time it takes to save the data to flash,&amp;nbsp; but if you do it sequentially in an application, make sure to wait for the callback before you try to read the flash record after it is updated.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226097?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 10:17:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1f88bdd-4a91-406c-ae3e-8441a0e1fc8c</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Cheers I got it to build and, it crashes with fatal error. I don&amp;#39;t need the cli but need to be able to write data to the flash which, in the fds_storage application i was using the command line to test.&lt;/p&gt;
&lt;p&gt;My question therefore, is how do I store the data?&lt;/p&gt;
&lt;p&gt;Note if I uncomment the cli_init it does not crash. And if I had it in and changed my pin definitions from my UART peripheral to the default the behaviour is the same as the fds_flash storage example.&lt;/p&gt;
&lt;p&gt;Hope I explained this well.&lt;/p&gt;
&lt;p&gt;I presume I do something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static configuration_t m_dummy_cfg =
{
    .config1_on  = false,
    .config2_on  = true,
    .boot_count  = 0x0,
    .device_name = &amp;quot;dummy&amp;quot;,
};

/* A record containing dummy configuration data. */
static fds_record_t const m_dummy_record =
{
    .file_id           = CONFIG_FILE,
    .key               = CONFIG_REC_KEY,
    .data.p_data       = &amp;amp;m_dummy_cfg,
    /* The length of a record is always expressed in 4-byte units (words). */
    .data.length_words = (sizeof(m_dummy_cfg) + 3) / sizeof(uint32_t),
};
//In main loop somewhere

rc = fds_record_write(&amp;amp;desc, &amp;amp;m_dummy_record);
//I want to set this as a string and as a new record&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But can I pass in a string?&lt;/p&gt;
&lt;p&gt;I want to set this as a string and as a new record.&lt;/p&gt;
&lt;p&gt;If not is it best to store the data as a struct or something of the like?&lt;/p&gt;
&lt;p&gt;Also how do I read this data as in the actual data inside the flash storage. Using the boot count value works but I would like to see all of the data stored.&lt;/p&gt;
&lt;p&gt;Also each time I reboot the dirty records increase by 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226093?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 10:08:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1e4580f-11b0-4914-916f-951178f55056</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If I were you, I&amp;#39;d try to stay clear of the CLI library, unless you intentionally are trying to use this. There is a uart library that e.g. the ble_app_uart example uses, that doesn&amp;#39;t use the CLI. CLI tend to make things a bit complicated.&lt;/p&gt;
&lt;p&gt;However, if you need the CLI, then it is possible. Your compiler doesn&amp;#39;t find the function&amp;nbsp;nrf_cli_uart_transport_api(). You are probably missing the&amp;nbsp;.c file that has this function. Then you also need the define:&lt;/p&gt;
&lt;p&gt;NRF_CLI_UART_ENABLED&amp;nbsp; to be defined to 1 in sdk_config.h.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But try to use the uart library that is used in the ble_app_uart example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/226039?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 08:36:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a538a74-15cd-4bad-8393-7641871794b6</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Hi Edvin, I&amp;#39;ll look into that I have had a lot of trouble with the UART example though from a previous issue.&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/54979/receiving-data-from-uart-via-a-peripheral-device"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/54979/receiving-data-from-uart-via-a-peripheral-device&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For more details.&lt;/p&gt;
&lt;p&gt;I am trying to merge the flash_fds code and my ble_app_beacon code. Presently I have an undefined reference to fds_register and many other error see below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  Linking ble_app_beacon_pca10056_s140.elf
    Output/ble_app_beacon_pca10056_s140 Release/Obj/cli.o:D:\Segger projects\Segger Projects\DeviceDownload2\examples\ble_peripheral\ble_app_beacon/cli.c:87: undefined reference to `nrf_cli_uart_transport_api&amp;#39;
Build failed&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, I have included in main:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifdef SOFTDEVICE_PRESENT
#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
#else
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#endif
#include &amp;quot;fds.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_cli.h&amp;quot;
#include &amp;quot;fds_example.h&amp;quot;

#define NRF_LOG_MODULE_NAME app
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;


/* A tag identifying the SoftDevice BLE configuration. */
#define APP_BLE_CONN_CFG_TAG    1
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also in my processor includes I have added:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;../../../../../../components/libraries/cli/uart
../../../../../../examples/peripheral/flash_fds
../../../../../components/libraries/uart
../../../../../../components/libraries/fifo
../../../../../../components/libraries/queue&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have also added a bunch of the c files required.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have changed these lines of code in the sdk to match the flash storage sdk config&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;CRC16_ENABLED 1//was 0
FS_ENABLED 1//was 0
FDS_CRC_CHECK_ON_READ 1//was 0
NRF_FSTORAGE_ENABLED 1//was 0
NRF_CLI_ENABLED 1//was 0
NRF_QUEUE_ENABLED 1 // Was 0
NRF_QUEUE_CLI_CMDS 1// Was 0


&lt;/pre&gt;Presently I have undefined references to nrf_queue_generic_pop and some more see above.&lt;/p&gt;
&lt;p&gt;I am not sure how to solve the nrf_cli_uart_transport api being undefined.&lt;/p&gt;
&lt;p&gt;If within nrf_cli_uart.c I uncomment the line if NRF_module_enabled(NRF_CLI_UART) it builds. But that therefore, means that the nrf_module is not enabled. All the code after that line is greyed out because it is not defined.&lt;/p&gt;
&lt;p&gt;From looking at this :&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/43311/undefined-reference-to-nrf_queue_generic_pop"&gt;undefined reference&lt;/a&gt;&amp;nbsp;I ensured NRF_CLI_ENABLED 1 but, it already was.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/225961?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 16:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f49b5b6-e9bb-4552-bc8f-f6f2916ef7c0</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;You need to use a BLE service + characteristic to transfer this data. The characteristic you need to use probably look a lot like the service that is implemented in the ble_app_uart example. This uses something called notifications to transfer data. In that example, it uses ble_nus_data_send() to send a text string, (or any other array of bytes).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you look into this example,&amp;nbsp; which you will find in SDK\examples\ble_peripheral\ble_app_uart, you can see that it usually calls ble_nus_data_send() inside the uart_event_handle(),&amp;nbsp; but you can send it at any other place in the code as well.&lt;/p&gt;
&lt;p&gt;Also note that you can queue several packets using ble_nus_data_send(), until it returns NRF_ERROR_RESOURCES. Once that is returned, you must wait for the&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE event (which you can add to&amp;nbsp;ble_evt_handler() in main.c),&amp;nbsp; that means that one packet is ACKed by the connected device, and there is some space free in the softdevice queue, and you can start queuing new packets.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/225938?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 14:50:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f79f9be4-1f7d-4fec-ac46-853a47439255</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Cheers Edvin I&amp;#39;ll look into those. Also would you therefore, have a recommendation about how to transmit data from the flash storage to my mobile application. As in what method should I use to do it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/225937?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 14:48:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa184f7d-0caf-4bf2-8c9d-5f137e440966</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If by &amp;quot;bluetooth&amp;quot; you mean &amp;quot;bluetooth classic&amp;quot;, then no, the nRF52840 doesn&amp;#39;t support it. But it does support Bluetooth Low Energy. (I guess you can call this a GATT Connection).&lt;/p&gt;
&lt;p&gt;For the different fields, such as Record Key and File ID, see &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds_format.html&amp;amp;cp=6_1_3_56_2_0_0&amp;amp;anchor=lib_fds_format_header"&gt;this page&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, see the guide in the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds_usage.html&amp;amp;cp=6_1_3_56_3" rel="noopener noreferrer" target="_blank"&gt;usage section on infocenter&lt;/a&gt;. This explains how to both write records, and to read records. Also, the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds_functionality.html&amp;amp;cp=6_1_3_56_1" rel="noopener noreferrer" target="_blank"&gt;Functionality section&lt;/a&gt; describes how to use record keys and File IDs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/225927?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 14:29:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7947589-262b-434c-8151-614c54e7194c</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Just to confirm then the nordic board is not capable of bluetooth connections then, meaning to transmit this data I will need a GATT connection?&lt;/li&gt;
&lt;li&gt;The data I want to store will be a string e.g 1,1100,1,1100,1,1000 something like that, this is my sensor data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also then how do I print a single data log entry.&lt;/p&gt;
&lt;p&gt;I presume something like this:&lt;/p&gt;
&lt;p&gt;read file_id key_id. And it should return that data.&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;From looking into it further I think the rec.id self increments and the file_id is passed into it.&lt;/p&gt;
&lt;p&gt;How do i therefore, read it.&lt;/p&gt;
&lt;p&gt;Also I need to merge this functionality of adding data to the flash storage with my project within the ble_peripheral folder. This however, uses UART with differently defined pins. I want the data to be added when new data comes in from this UART device not via the terminal.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory</title><link>https://devzone.nordicsemi.com/thread/225912?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 14:10:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9e2a0b3-1e49-40d9-b380-9355fb191784</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The Nordic Board is capable of Bluetooth Low Energy connections, just to answer your last question first.&lt;/p&gt;
&lt;p&gt;So you want to store data that is sampled every second. While this is possible, as you say, it will require 86400 entries every day. How large are these samples?&lt;/p&gt;
&lt;p&gt;As I see it, you have two options:&lt;/p&gt;
&lt;p&gt;Either you can use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fstorage.html&amp;amp;cp=6_1_3_57" rel="noopener noreferrer" target="_blank"&gt;fstorage module&lt;/a&gt;, or you can use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds.html&amp;amp;cp=6_1_3_56" rel="noopener noreferrer" target="_blank"&gt;FDS module&lt;/a&gt; (which uses fstorage module).&lt;/p&gt;
&lt;p&gt;The difference between the two is that fstorage is more &amp;quot;down to metal&amp;quot;,&amp;nbsp; where you need to decide to what address you want to write the data. Remember that you need to delete an entire flash page before you can write to the same address once more.&lt;/p&gt;
&lt;p&gt;FDS will handle this for you, and always write to a free address. It operates with records that you can write, update and delete.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Try to read a bit about each of them. The advantage is that this will make sure of an even flash wear distribution, which will make your flash last longer. The disadvantage is that it has more overhead per record, so you may need to consider to gather up data for e.g. one minute, and save it all in one record.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>