<?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>Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15467/disconnect-nrf51822-when-the-correct-connection-interval-is-not-negotiated-with-the-phone</link><description>Hi
Sometimes the nrf the central does not accept my connection interval of 7.5ms. I want to disconnect nrf51822 when the correct connection interval is not negotiated with the phone.just want to know if the if statement at the end of the code is the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Aug 2016 08:20:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15467/disconnect-nrf51822-when-the-correct-connection-interval-is-not-negotiated-with-the-phone" /><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59077?ContentTypeID=1</link><pubDate>Thu, 11 Aug 2016 08:20:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31661feb-31e0-4c1b-a764-06adf44d170f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi ua,&lt;/p&gt;
&lt;p&gt;Yes, but you need to check if it&amp;#39;s actually called or not. This will explain why update_timeout_handler() is not called.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s more important that you find out how the code works and why it didn&amp;#39;t work in your case. I would suggest you to add some UART debug trace to get to know what happens.&lt;/p&gt;
&lt;p&gt;Basically, the way it works is that depends on whether you set start_on_notify_cccd_handle = BLE_GATT_HANDLE_INVALID or not when init the module, the module will execute conn_params_negotiation() on either BLE_GAP_EVT_CONNECTED or BLE_GATTS_EVT_WRITE (when write to CCCD).
If you set start_on_notify_cccd_handle  to something, and then never write to CCCD, then connection parameter will never be executed.&lt;/p&gt;
&lt;p&gt;Inside conn_params_negotiation() we will check if the current parameter matched with what we want then we will do nothing and notify the main application with BLE_CONN_PARAMS_EVT_SUCCEEDED.&lt;/p&gt;
&lt;p&gt;If not, we will start the negotiation process by starting up the timer (if we haven&amp;#39;t started) and then in each timer timeout we will send a connection parameter request. We will do it MAX_CONN_PARAMS_UPDATE_COUNT (3) times, before we give up and notify the application that it&amp;#39;s failed.&lt;/p&gt;
&lt;p&gt;We will also do the same process if we receive a connection parameter update from the phone (BLE_GAP_EVT_CONN_PARAM_UPDATE event).&lt;/p&gt;
&lt;p&gt;So you job is to check why it didn&amp;#39;t go this way, or if it goes this way but you may want to modify something.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59078?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 16:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a53b990-b884-4b45-bd27-c4cbd127625b</guid><dc:creator>ua09</dc:creator><description>&lt;p&gt;I have added the code for  conn_params_negotiation in the question.n. I believe the app_start_timer is called in the right position&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59076?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 14:04:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:021efdf1-e992-4d4f-863f-be91e7d028d1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi ua,&lt;/p&gt;
&lt;p&gt;Please double check and see if&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = app_timer_start(m_conn_params_timer_id, timeout_ticks, NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;is called in conn_params_negotiation().
The timer should be started if  m_change_param = false (you are not calling ble_conn_params_change_conn_params() ) and when you are connected, or  when CCCD is written (depends on your configuration) or when the central update a new connection parameter.&lt;/p&gt;
&lt;p&gt;If you configured the max and min connection interval of 7.5ms and it not what you have when you are connected , the timer should already be started by the code in on_connect() in ble_conn_params.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59075?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 12:04:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0b765ed-c331-4aa2-be0e-204c28fe60de</guid><dc:creator>ua09</dc:creator><description>&lt;p&gt;it means that the correct value is negotitated&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59073?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 11:28:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4d20caa-5a5a-4179-a60a-aa9f77913358</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi ua,&lt;/p&gt;
&lt;p&gt;Could you explain this, I don&amp;#39;t understand:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Everytime the correct value is not negotiated, the update_timeout_handler has not been triggered. But when it works the update_timeout_handler is triggered.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What did you mean by when &amp;quot;it works&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59074?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 10:37:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebb45469-bc23-4ad1-bd3c-58b0b2836078</guid><dc:creator>ua09</dc:creator><description>&lt;p&gt;hi, i figured out why the correct connection interval is  sometimes not negotiated.
Everytime the correct value is not negotiated, the update_timeout_handler has not been triggered.
But when it works the update_timeout_handler is triggered. Do you have an idea why it is not triggered sometimes and a possible solution?
Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59071?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2016 12:35:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cd36132-998d-48b9-a2b4-b223630c25d5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@ua: Please make sure m_conn_params_timer_id timer is started and update_timeout_handler() is triggered on each timeout.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59070?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2016 11:09:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1462a8ce-5ecf-4269-bd63-9776ca88b002</guid><dc:creator>ua09</dc:creator><description>&lt;p&gt;Both max and min are set to 7.5ms&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59069?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2016 11:03:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41fbe6d1-dc06-447b-9400-c306c53055b0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@ua09: Could you try to debug and see if the update_timeout_handler() is triggered ? If you can provide a &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/"&gt;sniffer trace&lt;/a&gt; it could be very helpful.&lt;/p&gt;
&lt;p&gt;Which was the max connection interval and min connection interval you requested ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59072?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2016 14:59:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33c26aa8-911f-4438-856e-479323302e97</guid><dc:creator>ua09</dc:creator><description>&lt;p&gt;Hi
Thanks for the reply.
I removed the if statement ( and changed it in the question as well) and tried to implement this with cp_init.disconnect_on_fail = true; but it still does not work. when a connection interval of 7.5ms is not accepted a default of 48.75ms is accepted and the data slows down&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect nrf51822 when the correct connection interval is not negotiated with the phone</title><link>https://devzone.nordicsemi.com/thread/59068?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2016 14:21:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a1872d0-1f33-443e-af73-2766f6fde6e5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand why you check for the return code of ble_conn_params_init() and then call disconnect if it&amp;#39;s not success.&lt;/p&gt;
&lt;p&gt;ble_conn_params_init() is not really the place to check if the connection interval is not accepted by peer device. ble_conn_params_init() is where you configure the parameter with the ble_conn_params.c module. It only configure the parameter locally, and at that moment you don&amp;#39;t know if the peer device will accept or reject the request.&lt;/p&gt;
&lt;p&gt;What you should do is to configure the &lt;strong&gt;disconnect_on_fail&lt;/strong&gt; parameter. If you set it to true, later when the negotiation is failed, the ble_conn_params.c module will disconnect. Please have a look at the update_timeout_handler() function in the file.&lt;/p&gt;
&lt;p&gt;I can see that disconnect_on_fail is already set, did you see the behaviour that the peripheral disconnect after connection parameter update request failed ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>