<?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>SDK 14 migration: can&amp;#39;t advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24336/sdk-14-migration-can-t-advertise-fstorage-busy</link><description>Hi there. 
 I recently migrated from SDK 13 to SDK 14.0.0 and followed the migration guide in detail. I&amp;#39;ve found that when I try to advertise, ble_advertising_start() will find that fstorage is in use and bail out, expecting to try again once it&amp;#39;s no</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Aug 2017 14:20:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24336/sdk-14-migration-can-t-advertise-fstorage-busy" /><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95809?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 14:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:110ffd44-ae81-4a47-9d63-b33c85cb407f</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;So this was, quite frustratingly, just down to a missing define in my &lt;code&gt;app_config.h&lt;/code&gt; (like &lt;code&gt;sdk_config.h&lt;/code&gt;, but partial, and applied over the top).&lt;/p&gt;
&lt;p&gt;It turns out it&amp;#39;s entirely possible to build an app in which &lt;code&gt;NRF_SDH_SOC_ENABLED&lt;/code&gt; is not defined or is 0 and therefore there are no SoC events going out to observers at runtime. You won&amp;#39;t know it&amp;#39;s not happening, even if you&amp;#39;ve got the BLE advertising module set up properly. I&amp;#39;d have expected the app not to link, but it does.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95801?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0feeb632-6189-41b1-bebc-2fad54eec011</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;I guess you mean nrf_sdh_soc_evts_poll() in nrf_sdh_soc.c. Will take a look.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95800?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:43:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcdaf0dc-a5ef-4c51-840e-dbef88b14d0f</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;I see what you mean. BLE_ADVERTISING_DEF() calls NRF_SDH_SOC_OBSERVER() and passes it the ble_advertising_on_sys_evt() handler. I have all the sections in my linker script as per the HRS example, including the one for sdh_soc_observers. What poll loop? Where is that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95807?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:32:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00bde3b4-6713-4352-9c41-5126c6e8f7c2</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;yes that&amp;#39;s it - theres an sdh_ble_observers section, things put in there are iterated when you poll and dispatched to. So just go back to the poll loop and work out whether you&amp;#39;re getting FLASH events or not.&lt;/p&gt;
&lt;p&gt;Before BLE starts up, working out what&amp;#39;s going on with a debugger is pretty simple and at this point, BLE hasn&amp;#39;t started up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95806?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:330067eb-118d-4b04-85c7-ba9a988c9b10</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well I see some macros NRF_SDH_BLE_OBSERVER which seem at first glance to set up static data which the ble system reads and adds handlers. That uses those blasted sections which are fine in keil but a total pain in the ass in SES and other IDEs and require you to go fix the linker scripts in 10 places.&lt;/p&gt;
&lt;p&gt;So my guess is that&amp;#39;s where it&amp;#39;s set up.&lt;/p&gt;
&lt;p&gt;The SDK has become a bit too clever for its own good and now tries to save you from yourself having to remember to register things, net result, the code is magical and when it doesn&amp;#39;t do what you expect, it&amp;#39;s nigh on impossible to figure out why.&lt;/p&gt;
&lt;p&gt;hat&amp;#39;s my guess anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95805?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:17:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:405534aa-5b9d-4a6f-a863-38aed3865486</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;also it seems rather suspicious that the peer manager (or rather the fds subsystem) decides every time you run it that it&amp;#39;s not initialized and goes and writes. You&amp;#39;d think it would happen once (or once each time you wiped the chip) and then next time through it would decide it&amp;#39;s initialized and return early without a write. So that makes it seem as if the writes aren&amp;#39;t completing or aren&amp;#39;t being scheduled, which may then be why they aren&amp;#39;t triggering the advertising module to restart. eg for instance the fds system doesn&amp;#39;t see the write event, so it never marks itself as &amp;#39;ok&amp;#39;, the advertising module does see it but thinks fds is still busy and doesn&amp;#39;t start.&lt;/p&gt;
&lt;p&gt;That would also happen if the advertising module gets the event BEFORE the fds system sees it. It would try to restart, the fds system is still busy. Doesn&amp;#39;t explain why it re-inits every time. Should be able to trace thru that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95804?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:16:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37a82c2b-4568-4d9a-80ec-71b2451dec3d</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Yes of course, a breakpoint in ble_advertising_on_sys_evt() is never hit. I can&amp;#39;t see how that function is set up as a handler, since there are no references to it anywhere else in the SDK that I can find. If I knew that, I wouldn&amp;#39;t be asking the question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95803?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:09:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28c6b262-b37b-4309-b64f-1e1334aa43fb</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand your questions sometimes. You have the whole stack trace, you have all the source code, you can see that write() is supposed to be happening there by just looking quickly through the function. If you&amp;#39;re at line 1639 you went past the &amp;#39;already init&amp;#39; stage and so fds has queued up operations.&lt;/p&gt;
&lt;p&gt;As to why the advertising manager doesn&amp;#39;t pick up again .. well have you put a breakpoint in that routine, is it ever called? Probably not. So either it&amp;#39;s not hooked up, or the event isn&amp;#39;t ever being generated (which would be bad) or you&amp;#39;re not getting to the event loop processing code and dequeueing them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95802?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 10:08:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0ee51ba-0b3e-4893-8f0f-d0e039071d40</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;@RK Thanks. Confirmed it&amp;#39;s the peer manager doing a write. See edit above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95798?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 21:13:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22ebec88-5680-481a-a950-3ec44280e7ef</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and does initializing the peer manager cause it to queue up and start an fstorage operation as the first thing it does? Should be quite easy  to pop a breakpoint on the code which increments the queue count on that fstorage SD module and see the stack trace where it&amp;#39;s called. Sounds legit to me. The other part of the original question about whether the right things are hooked into the event stream is more interesting, however I don&amp;#39;t really have any insight not having done any work (sadly) with recent SDKs or softdevices.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95799?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 15:09:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fed7fa64-7352-4927-9de3-d5653f7ccf92</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;No, it&amp;#39;s a custom app that uses a custom service, based on the HRS and buttonless DFU bootloader examples. I checked and it looks like the peer manager is the only user of the fstorage module. I init that before I start to advertise of course.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95808?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 13:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20b95545-aad5-413d-bf03-aaeac4a056ed</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Are you saying you are experiencing this with the unmodified HRS example from SDK 14.0.0?&lt;/p&gt;
&lt;p&gt;If is_busy() returns true I guess m_queue.cnt !=0. Could you check?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static bool is_busy(nrf_fstorage_t const * p_fs)
{
    return (m_queue.cnt != 0);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95797?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 09:02:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21c5b0e9-1e98-4a8d-9259-2cbfa51c16d4</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Thanks, good point. Have done that and added an edit above, but I&amp;#39;m not sure what it tells me. Not sure how to see the module using the fstorage instance from this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK 14 migration: can't advertise. fstorage busy.</title><link>https://devzone.nordicsemi.com/thread/95796?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 20:48:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c80254de-05c8-4bfe-858d-0f23d960dceb</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;The first part can&amp;#39;t be too hard to work out - just single step the busy function to find out which of the registered fstorage modules is returning true. Since you&amp;#39;ve not even started advertising, you can single step to your hearts content. There&amp;#39;s probably only one such module registered and a couple of breakpoints should quickly show where it&amp;#39;s being used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>