<?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 fds storage: Issue with fds_record_write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87500/nrf51822-fds-storage-issue-with-fds_record_write</link><description>Hello everyone! 
 We are using nRF51822 SoC together with s130 Softdevice. nRF5 SDK v12.3.0 is used for firmware development together with the Segger Embedded Studio. 
 Among the other things, we have a need to store one 32-bit variable in non-volatile</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 May 2022 12:21:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87500/nrf51822-fds-storage-issue-with-fds_record_write" /><item><title>RE: nRF51822 fds storage: Issue with fds_record_write</title><link>https://devzone.nordicsemi.com/thread/365975?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 12:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c12aa0e7-4a84-4109-a129-b74db6594290</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;Thanks for the suggestions, Kenneth!&lt;/p&gt;
&lt;p&gt;Changing FS_OP_MAX_RETRIES or connection interval parameters did not resolve the issue. &lt;/p&gt;
&lt;p&gt;What resolved the issue is putting the event into the scheduler queue with &lt;span style="background-color:#ccffcc;"&gt;&lt;em&gt;&lt;strong&gt;app_sched_event_put()&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; API.&lt;/p&gt;
&lt;p&gt;Writing into the FDS from withing scheduler handler function did the job for us!&lt;/p&gt;
&lt;p&gt;Thanks in advance for your hints! I think we can close the ticket now.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 fds storage: Issue with fds_record_write</title><link>https://devzone.nordicsemi.com/thread/365960?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 11:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86b3c391-6209-43ad-a0ed-80388c866687</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Flash operations have very low priority compared to other softdevice taks:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/multilink_scheduling/priorities_and_events_intro.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/multilink_scheduling/priorities_and_events_intro.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, it may take considerably time before the flash operation completes or it can even timeout if the softdevice is not able to execute the flash operation due to other higher priority activities. What you can try is to for instance configure&amp;nbsp;FS_OP_MAX_RETRIES to 1000, that should at least give more retries before it &amp;quot;give up&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To give the softdevice time to execute flash operations, it may help to increase the connection interval, and at least use slave latency on the link, since this will allow connection intervals to be skipped (e.g. to handle flash operations if needed).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 fds storage: Issue with fds_record_write</title><link>https://devzone.nordicsemi.com/thread/365907?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 08:43:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f1659cc-8a99-4431-96a8-198e6ed49cf7</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;Hey, guys... here are some additional pieces of information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when I initialize the FDS module &lt;span style="background-color:#ccffcc;"&gt;&lt;em&gt;&lt;strong&gt;AFTER&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; initializing the Bluetooth module (gap, advertising, gatt, services, connection parameters), then I am able to properly write an initial value to the flash by using &lt;span style="background-color:rgba(204, 255, 204, 1);"&gt;&lt;em&gt;&lt;strong&gt;fds_record_write()&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; function. &lt;span style="background-color:rgba(255, 153, 204, 1);"&gt;&lt;em&gt;&lt;strong&gt;FDS_EVT_WRITE&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; event is properly detected.&lt;/li&gt;
&lt;li&gt;However, when I establish BLE connection with the Central device and want to update the flash with &lt;span style="background-color:rgba(204, 255, 204, 1);"&gt;&lt;em&gt;&lt;strong&gt;fds_record_write()&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; or &lt;span style="background-color:rgba(204, 255, 204, 1);"&gt;&lt;em&gt;&lt;strong&gt;fds_record_update()&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; functions then write/update record operation was queued successfully but we never get the &lt;span style="background-color:rgba(255, 153, 204, 1);"&gt;&lt;em&gt;&lt;strong&gt;FDS_EVT_WRITE/UPDATE&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; event inside the event handler.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It seems to me that the FDS module has some limitations when used in the presence of the Softdevice. I know that the Peer Manager is also using FDS. Is there anything we should do to make the FDS module works together with the Softdevice?&lt;/p&gt;
&lt;p&gt;Some threads that are reporting similar issue (e.g. &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70949/fstorage-event-handler-never-fired-for-erase-operation-with-1-active-ble-connection" rel="noopener noreferrer" target="_blank"&gt;link1&lt;/a&gt;, &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/60556/module-requires-3-power-cycles-to-initialize-fds-manager/253389#253389" rel="noopener noreferrer" target="_blank"&gt;link2&lt;/a&gt;) suggest including &lt;span style="background-color:#ccffcc;"&gt;&lt;em&gt;&lt;strong&gt;${SDK_ROOT}/components/softdevice/common/nrf_sdh_soc.c&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt; file in the build. However, nRF5 SDK v12.3.0 does not contain that file. Is there anything similar we should include?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>