<?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>A BLE_GAP_EVT_DISCONNECTED event has occurred after pairing with my phone. &amp;amp; I can not pair with Android app.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36387/a-ble_gap_evt_disconnected-event-has-occurred-after-pairing-with-my-phone-i-can-not-pair-with-android-app</link><description>Hi. 
 I am using nRF52832 and SDK15, S132 Softdevice. 
 I integrated the uart example in the ble_peripheral folder with the buttonless_dfu example, and added the passkey. 
 The cell phone is Android. 
 
 I turned on Bluetooth on my phone and found the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 31 Jul 2018 09:27:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36387/a-ble_gap_evt_disconnected-event-has-occurred-after-pairing-with-my-phone-i-can-not-pair-with-android-app" /><item><title>RE: A BLE_GAP_EVT_DISCONNECTED event has occurred after pairing with my phone. &amp; I can not pair with Android app.</title><link>https://devzone.nordicsemi.com/thread/142112?ContentTypeID=1</link><pubDate>Tue, 31 Jul 2018 09:27:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89333656-233f-4119-8098-cc661106cec6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The advertisement timeout is what triggers the BLE_ADV_EVT_IDLE event, and not the other way around. So the advertisement will time out even though you remove sleep_mode_enter();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to keep advertising &amp;quot;forever&amp;quot;, you must do the two following steps:&lt;/p&gt;
&lt;p&gt;Near the top of main.c, you will find the &amp;quot;#define&amp;nbsp;APP_ADV_DURATION 18000&amp;quot;. Change this to &amp;quot;#define APP_ADV_DURATION 0&amp;quot;&lt;/p&gt;
&lt;p&gt;Next, in advertising_init() in main.c, you must change the advdata flag:&lt;/p&gt;
&lt;p&gt;init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;&lt;/p&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;p&gt;init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then it should not stop advertising.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A BLE_GAP_EVT_DISCONNECTED event has occurred after pairing with my phone. &amp; I can not pair with Android app.</title><link>https://devzone.nordicsemi.com/thread/140889?ContentTypeID=1</link><pubDate>Sat, 21 Jul 2018 11:40:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:461d00aa-bac8-4cbd-88a5-f46ae48d62ce</guid><dc:creator>powerup</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;I want to get rid of the 180 second ad timeout.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;So I made the following changes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;pre class="ui-code" data-mode="golang"&gt;static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
    uint32_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
            err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
            APP_ERROR_CHECK(err_code);
            break;
        case BLE_ADV_EVT_IDLE: 
            //sleep_mode_enter();
            break;
        default:
            break;
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;However, after 180 seconds,&amp;nbsp;nRF52832 will not enter sleep mode, but your ads will end.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span lang="en"&gt;What should I do to keep my ads going?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span lang="en"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span lang="en"&gt;Thank you.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A BLE_GAP_EVT_DISCONNECTED event has occurred after pairing with my phone. &amp; I can not pair with Android app.</title><link>https://devzone.nordicsemi.com/thread/140235?ContentTypeID=1</link><pubDate>Mon, 16 Jul 2018 14:06:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb33de8f-6f51-416c-a140-dad6309ac600</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding the BLE_GAP_EVT_DISCONNECT event, 180 seconds, and BLE_ADV_EVT_IDLE sequence, this is expected, as most of our examples have 180 seconds advertising timeout. If it isn&amp;#39;t connected within this time, it will go to system off mode, to save power. It is possible to disable this, if you want to, so that the device will keep advertising.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Disconnection reason 0x13 is&amp;nbsp;BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION (see the file ble_hci.h in the SDK).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It sounds like one of your devices (either phone or nRF) has stored the bonding information, while the other has not. Can you try to delete the bonding information on both of your devices? On the phone, this is usually done in the bluetooth settings. On the nRF, since you might haven&amp;#39;t added the delete bond functionality in your application yet, the easiest way is to erase the DK/chip, reprogram the softdevice and your application, and try to bond again. If it succeeds, you can turn on and off your phone and nRF, and they should remember the bonding information.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Bonding is an optional step. You can read a short description on connection, pairing, bonding and whitelisting &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/11939/connecting-bonding-pairing-and-whitelists"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are interrested, you can try the ble_app_hids_keyboard example from the SDK:&lt;/p&gt;
&lt;p&gt;SDK\examples\ble_peripheral\ble_app_hids_keyboard\...&lt;/p&gt;
&lt;p&gt;which will reconnect automatically after a power cycle on the nRF.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>