<?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>Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14629/issue-with-advertising-restart-after-disconnect</link><description>All, 
 Can anyone tell me what is the fastest time that a ble SD (5.x / 6.x) running on an nRF51 can (re)start advertising from a disconnect. Basically looking to do an [advertise -&amp;gt; connect -&amp;gt; receive (1 byte) -&amp;gt; disconnect] and then back to advertise</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Aug 2016 21:37:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14629/issue-with-advertising-restart-after-disconnect" /><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55827?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 21:37:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e44230e-b1ea-429e-b2da-c78aa4d796d9</guid><dc:creator>Lully-Mark</dc:creator><description>&lt;p&gt;I&amp;#39;ll try to pull some code together so you can take a look. I don&amp;#39;t think the part is resetting as the reset mechanism would be noticeable for us, and I haven&amp;#39;t observed it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55826?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 20:59:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:654a862e-71d9-4564-8982-ef94d746524b</guid><dc:creator>mstrouse</dc:creator><description>&lt;p&gt;Can you post your advertising init and advertising start code? My problem was directly traced to my advertising init and start functions. I might suggest you make sure you have the app_error_handler enabled (it will tell you what file and line number is causing an error). Essentially I was having an error that was then resetting the part. Once I tracked down the error, everything worked as expected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55825?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 16:50:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd71d50a-1c85-40ae-bbac-e2455bcc615c</guid><dc:creator>Lully-Mark</dc:creator><description>&lt;p&gt;The heartrate app is heavily modified, but quite a bit of the structure (especially of main.c) is the same. The advertising, connection parameters, and functions are almost exactly the same. They added some GATTS services and characteristics in another piece of code as well, so I&amp;#39;m trying to trace the delay. I was hoping that whatever you found would provide some insight to try to track down what may be going on in our code as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55829?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 00:49:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7afaf3a-4dcf-437a-ba94-0bc0da9cfb10</guid><dc:creator>mstrouse</dc:creator><description>&lt;p&gt;What version of SDK / SD are you using? How much did they modify the HRS demo?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55828?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 23:04:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fa94978-693b-4aff-a434-7fc827182a6d</guid><dc:creator>Lully-Mark</dc:creator><description>&lt;p&gt;mstrouse,&lt;/p&gt;
&lt;p&gt;Would you be able to elaborate on the code you needed to fix? We are running into a similar error and are stuck. Our consultants used the HeartRate demo app, and we are trying to sort through it now to discover why it takes approximately 10 seconds for the BLE_GAP_EVT_DISCONNECTED is issued.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55824?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 17:03:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c14a2940-8100-49f8-a3ca-fee1c873c86b</guid><dc:creator>mstrouse</dc:creator><description>&lt;p&gt;This has now been solved. After investigation / debugging, the issue was a combination of a coding mistake and needing to restructure some code.  The turn around time (between disconnect and the start of advertising) is now in the few hundred milliseconds range.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55822?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 07:14:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05f6725e-272b-4be8-a52a-8b87a223c003</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Do you have an extra nRF51-DK or a nRF51-Dongle? If so, could you use &lt;a href="https://www.nordicsemi.com/eng/nordic/download_resource/26386/14/65517724"&gt;the sniffer&lt;/a&gt; to track the disconnect?  And upload the sniffer trace here?&lt;/p&gt;
&lt;p&gt;The sniffer should be used with Wireshark, and it works best with version 1.10, not one of the newer versions. Wireshark can be downloaded here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.wireshark.org/download/win32/all-versions/"&gt;www.wireshark.org/.../&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.wireshark.org/download/win64/"&gt;www.wireshark.org/.../&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55823?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 19:33:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1bb4a15-7463-4047-828c-86849ee8a9ea</guid><dc:creator>mstrouse</dc:creator><description>&lt;p&gt;So the difference (on my setup) is that the time between sd_ble_gap_disconnect() and receiving BLE_GAP_EVT_DISCONNECTED is not anywhere close to 80mS.  It&amp;#39;s at least 4 seconds ... sometimes much longer.&lt;/p&gt;
&lt;p&gt;And yes, I&amp;#39;ve verified that the reset is caused from the APP_ERROR_HANDLER() after calling advertising_start()/sd_ble_gap_adv_start() too soon (before I receive BLE_GAP_EVT_DISCONNECTED). If I wait, I&amp;#39;m back to 4+ seconds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55821?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 10:35:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd4230aa-88a5-48de-a355-ad80c5937aa2</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I have updated my answer to answer your questions. Let me know if it is still unclear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55820?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2016 13:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9ff16b6-fb43-4c8b-8df5-795960c7f5c3</guid><dc:creator>mstrouse</dc:creator><description>&lt;p&gt;&amp;quot;The chip should be able to start advertising right after disconnecting.&amp;quot; Can you quantify / prove this statement? Is there anything in the documentation that tells how long it takes for the SD to tear down a current connection (internal structures / resources, etc), and to be ready to start advertising?&lt;/p&gt;
&lt;p&gt;And by saying &amp;quot;disconnecting&amp;quot; ... do you mean the act of calling &amp;quot;sd_ble_gap_disconnect()&amp;quot;, or does that mean waiting to receive a disconnect event in my &amp;quot;on_ble_evt(ble_evt_t * p_ble_evt)&amp;quot; loop?&lt;/p&gt;
&lt;p&gt;As for the reset that occurs when calling &amp;quot;advertising_start()&amp;quot; (immediately after &amp;quot;sd_ble_gap_disconnect&amp;quot;), I&amp;#39;ll admit that I am not rigorously error checking. This was done out of expediency to find a solution. That said, I suspect that the reset is caused by the SD not having finished closing the previous connection when I call &amp;quot;advertising_start()&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with advertising restart after disconnect...</title><link>https://devzone.nordicsemi.com/thread/55819?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2016 09:15:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca4d0e38-b45a-42a0-8e59-5b9df94daa9a</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;The chip should be able to start advertising right after disconnecting. It means that after calling sd_ble_gap_disconnect(..), advertising_start()/sd_ble_gap_adv_start(..) can be called immediately when receiving BLE_GAP_EVT_DISCONNECTED. If calling advertising_start()/sd_ble_gap_adv_start() before BLE_GAP_EVT_DISCONNECTED, sd_ble_gap_adv_start(..) will return the error NRF_ERROR_INVALID_STATE.&lt;/p&gt;
&lt;p&gt;A quick test here showed that it took 80 ms from the LL_TERMINATE_IND (disconnect) was transmitted until the device started to advertise:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/disconnect.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;The reset could be caused by a function returning an error handled by APP_ERROR_HANDLER(..) that results in a reset. If you run the chip in debug mode, you can set breakpoints at where you think the error may occur, and check if some error codes are returned. It can also be useful to take a look at this post regarding &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/?answer=60126#post-id-60126"&gt;&amp;quot;chip is resetting&amp;quot;&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>