<?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>NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9905/nrf_error_busy-returned-re-starting-ble-beacon-advertising</link><description>Hey guys, 
 Working with the simple be_app_beacon example on nRF51. I’d like to be able to stop and start advertising. But after stopping advertising, I’m unable to start it again. On the call to start advertising I’m getting an err_code of NRF_ERROR_BUSY</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Nov 2015 13:58:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9905/nrf_error_busy-returned-re-starting-ble-beacon-advertising" /><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36744?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 13:58:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1850fc1-3083-42b4-82d9-5a8723b170e7</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;In ble_stack_init() you need to add:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you need to define the event handler:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    if((p_ble_evt-&amp;gt;header.evt_id == BLE_GAP_EVT_TIMEOUT) &amp;amp;&amp;amp; (p_ble_evt-&amp;gt;evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING))
    {
         //Start advertising or not
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36743?ContentTypeID=1</link><pubDate>Sat, 31 Oct 2015 01:28:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3ab8ac4-1587-4fc5-bed4-59819b6bd016</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Thanks Petter... really appreciated.&lt;/p&gt;
&lt;p&gt;One last question.   I&amp;#39;m using the template/example provided in SDK 9-2, ble_app_beacon, and its not clear to me where to initialize advertising with a callback to an event handler to catch BLE_GAP_EVT_TIMEOUT as you point out.   Is it possible?&lt;/p&gt;
&lt;p&gt;Thanks,
Brian&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;You can also skip the timer. Set the timeout to 1 second, and the interval to for example 1100 ms. Then when you get BLE_GAP_EVT_TIMEOUT you start advertising again, or not.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36742?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 15:18:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01a982f9-55d6-495d-892c-93133a00382c</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;If you are not doing anything else, for example scanning or something else (I don&amp;#39;t know what SoftDevice you are using) the advertisement will be sent pretty quickly, but exactly how fast I don&amp;#39;t know. 100 ms should be fine. You can find out by using &lt;a href="https://devzone.nordicsemi.com/tutorials/14/radio-notification/"&gt;Radio Notifications&lt;/a&gt; or a sniffer.&lt;/p&gt;
&lt;p&gt;You can also skip the timer. Set the timeout to 1 second, and the interval to for example 1100 ms. Then when you get BLE_GAP_EVT_TIMEOUT you start advertising again, or not.&lt;/p&gt;
&lt;p&gt;I also want to point out that when I say one advertisement, I mean three advertising packet on each of the three advertising channels.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36741?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 14:31:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:065d70dc-5f96-4dd6-9930-25c822c41df8</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Also, if I really only want to send on advertisement per second, how quickly should I stop advertising after starting it?  ~999ms? Assuming an interval of 1000ms.   In other words, after starting advertising, how quickly is that first advertisement sent?
Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36740?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 14:28:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0b85282-dba6-4602-83c4-78dd93459367</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Yup.  Got that.  What I&amp;#39;m finding in SDK9-2 is that if the timeout is 1 second.   And I wait more than 1 second after starting advertising, then trying to restart advertising after the timeout period I get the NRF_BUSY error.&lt;/p&gt;
&lt;p&gt;With timeout of 1 second, and a delay of only 500ms, let&amp;#39;s say, then stoping and starting works ok.   Seems strange... but no big deal.  Now I&amp;#39;m just setting the timeout to 0, and manually starting and stopping and it&amp;#39;s working ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36738?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 08:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4dc2edd-0eb9-419a-b503-6bed14dfdb19</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What error code do you get with sd_ble_gap_adv_stop()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36739?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 08:21:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b797aa14-2c96-4b51-a3d1-c6d7ba0700ae</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;pre&gt;&lt;code&gt;#define APP_CFG_NON_CONN_ADV_TIMEOUT  1
#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(1000, UNIT_0_625_MS)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will send one advertisement per second for 1 second.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define APP_CFG_NON_CONN_ADV_TIMEOUT  0
#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(1000, UNIT_0_625_MS)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will send one advertisement per second forever, or until you call sd_ble_gap_adv_stop().&lt;/p&gt;
&lt;p&gt;If you always want to stop the advertisements manually you can set the timeout to 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36737?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2015 04:01:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:917f0888-e3d1-4686-9395-47ab978e8652</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Hi Petter,&lt;/p&gt;
&lt;p&gt;Thanks for the response.   I figured something out:&lt;/p&gt;
&lt;p&gt;The settings causing this behavior are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define APP_CFG_NON_CONN_ADV_TIMEOUT  1
#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(1000, UNIT_0_625_MS) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I change to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define APP_CFG_NON_CONN_ADV_TIMEOUT  0
#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(1000, UNIT_0_625_MS) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then no problem.   Why is this?  I&amp;#39;m trying to just send one advertisement per second, but be able to start and stop.  Should these settings also send just one advertisement per sec?&lt;/p&gt;
&lt;p&gt;Thanks,
Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY returned, re-starting BLE beacon advertising</title><link>https://devzone.nordicsemi.com/thread/36736?ContentTypeID=1</link><pubDate>Mon, 26 Oct 2015 09:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94a01da4-0e97-492a-86ba-08728c3acc0c</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure what is causing this. Would it be possible for you to upload your complete project? Or a project that produces the error? What SoftDevice and SDK version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>