<?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 in nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101636/storing-data-to-flash-memory-in-nrf52832</link><description>Hi, 
 I am using the Nordic nRF52832 with SDK 17. 
 
 I want to store data to flash memory with BLE, DFU, and WDT enabled. I am using a customized application of ours to send some configurations to nRF52 via BLE. Now I aim to store the configuration data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jul 2023 11:50:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101636/storing-data-to-flash-memory-in-nrf52832" /><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/436990?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 11:50:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cf99906-ffd4-471c-9dd0-6be75e233e46</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what you&amp;#39;re trying to do here, you would have to explain in more detail before I&amp;#39;d be able to help you.&lt;/p&gt;
&lt;p&gt;But first I&amp;#39;d like you to read this from the documentation I linked you:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This backend is an observer of SoftDevice state change requests. When a request to change the state of the SoftDevice is made through the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh.html"&gt;SoftDevice Handler&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;library by calling&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh.html#ga574d17fdf1c59dec6355e3f525c484ec"&gt;nrf_sdh_enable_request&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;or&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh.html#ga38fb7087993c1e6eae22c0e00725640e"&gt;nrf_sdh_disable_request&lt;/a&gt;, fstorage will receive this request. Then, depending on whether there are ongoing flash operations issued by any of its users, it will defer or acknowledge the SoftDevice state change.&lt;/p&gt;
&lt;p&gt;In practice, this means that it is possible to disable and enable the SoftDevice at will with the guarantee that flash operations won&amp;#39;t be disrupted.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The way I understand this is that you could disable the SoftDevice while doing fds_read, to make sure you can read flash uninterrupted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/436953?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 10:00:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de006462-8bb8-4164-b1e4-979c78ca7ed0</guid><dc:creator>ZaQa</dc:creator><description>&lt;p&gt;It&amp;#39;s in&amp;nbsp;my_fds_evt_handler:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;static void my_fds_evt_handler(fds_evt_t const * const p_fds_evt)&lt;br /&gt;{&lt;br /&gt;uint32_t err_code;&lt;br /&gt; switch (p_fds_evt-&amp;gt;id)&lt;br /&gt; {&lt;br /&gt; case FDS_EVT_INIT:&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; m_fds_ready = true;&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case FDS_EVT_DEL_RECORD:&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case FDS_EVT_DEL_FILE:&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case FDS_EVT_UPDATE:&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; m_pending_update = true;&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case FDS_EVT_WRITE:&lt;br /&gt; if (p_fds_evt-&amp;gt;result != NRF_SUCCESS)&lt;br /&gt; {&lt;br /&gt; //write failed&lt;br /&gt; printf(&amp;quot;write failed\r\n&amp;quot;);&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; m_pending_write = true;&lt;br /&gt; }&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case FDS_EVT_GC:&lt;br /&gt; APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);&lt;br /&gt; NRF_LOG_INFO(&amp;quot;Garbage Collector activity finished.&amp;quot;);&lt;/p&gt;
&lt;p&gt;//Perform pending write/update.&lt;br /&gt; if (m_pending_write)&lt;br /&gt; {&lt;br /&gt; NRF_LOG_DEBUG(&amp;quot;Write pending msg.&amp;quot;, p_fds_evt-&amp;gt;id, p_fds_evt-&amp;gt;result);&lt;br /&gt; m_pending_write = false;&lt;br /&gt; }&lt;br /&gt; else if (m_pending_update)&lt;br /&gt; {&lt;br /&gt; NRF_LOG_DEBUG(&amp;quot;Update pending msg.&amp;quot;, p_fds_evt-&amp;gt;id, p_fds_evt-&amp;gt;result);&lt;br /&gt; m_pending_update = false;&lt;br /&gt; }&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;default:&lt;br /&gt; break;&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/436925?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 08:48:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a7ecd2b-fd7e-4f96-bcbf-6c0c809518b1</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Where do you have the m_pending_write value from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/436585?ContentTypeID=1</link><pubDate>Sat, 15 Jul 2023 08:09:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da118090-5141-4f35-ba39-8b827153b0a1</guid><dc:creator>ZaQa</dc:creator><description>&lt;p&gt;Thank you! I went through this document and assured you I&amp;#39;ve already done every step and setup configuration included in this link.&amp;nbsp;&lt;br /&gt;The thing is that if I disable BLE, the FDS process will execute well but if I enable BLE everything will stop right at the while loop line:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;fds_write();&lt;br /&gt; while(m_pending_write == false);&lt;br /&gt; m_pending_write =false;&lt;br /&gt; fds_read();&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/435778?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2023 14:38:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f33aa081-a2f6-4c17-93a8-37b1c19c1e45</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Have a look at this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_fstorage.html&amp;amp;cp=9_1_3_17_5_0&amp;amp;anchor=lib_fstorage_sd"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_fstorage.html&amp;amp;cp=9_1_3_17_5_0&amp;amp;anchor=lib_fstorage_sd&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;FDS uses the fstorage API, which uses the SoftDevice to access flash.&lt;/p&gt;
&lt;p&gt;Please see the suggestions in the documentation above for how to use BLE and fstorage concurrently.&lt;/p&gt;
&lt;p&gt;-Einar&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/435604?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2023 05:02:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c88fd7ec-0896-41a6-8d0f-5cde38cf8cc8</guid><dc:creator>ZaQa</dc:creator><description>[quote userid="111520" url="~/f/nordic-q-a/101636/storing-data-to-flash-memory-in-nrf52832/435489"]It could be that your timer interrupts are messing up the BLE functionality. It could perhaps help to make the timer interrupts lower priority.[/quote]
&lt;p&gt;I guess that&amp;#39;s not the case for my application; the timer interrupts priority is 6, and I think that counts pretty low. &lt;br /&gt;It seems that my FDS function only works when BLE is disabled (at the first stage when the device is about to start and at the end when everything has been disabled and the device is going to shut down). The thing is that I need it to store some configuration data regularly, like every 5 minutes. In this case, whenever I call the FDS function, only the write function works fine, and there is some problem with the read function. Do you have any idea why it is happening?&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/435489?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2023 12:18:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ef161be-bbae-4100-a223-c0534a8f4f47</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;I see.&lt;/p&gt;
&lt;p&gt;It could be that your timer interrupts are messing up the BLE functionality. It could perhaps help to make the timer interrupts lower priority.&lt;/p&gt;
&lt;p&gt;Also note that something like stepping through the code in debug mode could mess up the BLE functions.&lt;/p&gt;
&lt;p&gt;-Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/435463?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2023 11:28:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c77c379a-297d-4342-8f73-4f583ceec47f</guid><dc:creator>ZaQa</dc:creator><description>&lt;p&gt;Thank you for your response.&lt;br /&gt;&lt;br /&gt;If I put it before setting up BLE in the main, it works fine; but calling FDS after initializing BLE does not work at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Storing Data to flash memory in nRF52832</title><link>https://devzone.nordicsemi.com/thread/435451?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2023 10:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfeb61fa-3775-4395-b8e1-d33eae55a07e</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;Since this only happens when you run this function from the timer handler, could you try to instead signal from the timer handler that the event has occurred and then execute it from main?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>