<?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>Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57789/connecting-to-device-using-pc-ble-driver-py-causes-disconnect-after-60-seconds</link><description>In order to test my custom BLE protocol on my device I am attempting to use the pc-ble-driver-py Python module (either 0.11.4 or latest version) to connect to my BLE peripheral running with a modified version of the app-template from SDK v12.3.0 on nRF52832</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Feb 2020 18:01:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57789/connecting-to-device-using-pc-ble-driver-py-causes-disconnect-after-60-seconds" /><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/235279?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 18:01:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40ae924d-d808-495e-afa5-4269f50b9bef</guid><dc:creator>Ryan Lindeman (CAE)</dc:creator><description>&lt;p&gt;I adjusted my Python central code to respond to the incoming &amp;quot;gap_evt_conn_param_update_request&amp;quot; event by attempting to call the ble_adapter.conn_param_update method but unfortunately it fails. I strongly suspect that the ble_adapter.py conn_param_update method is broken as there is no &amp;quot;status&amp;quot; key provided by the &amp;quot;gap_evt_conn_param_update&amp;quot; event.&lt;/p&gt;
&lt;p&gt;As a workaround I am calling the ble_driver.ble_gap_conn_param_update method directly instead and holding off service discovery until I receive the initial&amp;nbsp;&lt;span&gt;gap_evt_conn_param_update_request. This seems to solve my disconnect problem for now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1538.controller.py"&gt;devzone.nordicsemi.com/.../1538.controller.py&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/235269?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 16:57:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd99ddc7-1537-4c28-915f-d999c9129394</guid><dc:creator>Ryan Lindeman (CAE)</dc:creator><description>&lt;p&gt;I am already setting cp_init.disconnect_on_fail to false and it is still disconnecting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/235084?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2020 08:52:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed58e10b-3913-4dec-bd13-6af880ce7c2e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;The fact that it comes during the discovery procedure shouldn&amp;#39;t be a problem, but it is still something you need to handle.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please look at some of the ble_central examples from our &amp;quot;normal&amp;quot; SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;E.g. in the ble_app_uart_c example, you can see the event in ble_evt_handler()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            // Accepting parameters requested by peer.
            err_code = sd_ble_gap_conn_param_update(p_gap_evt-&amp;gt;conn_handle,
                                                    &amp;amp;p_gap_evt-&amp;gt;params.conn_param_update_request.conn_params);
            APP_ERROR_CHECK(err_code);
            break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Where it replies to the connection update request.&lt;/p&gt;
&lt;p&gt;The answer to the request depends on the parameter preferences in the central projects sdk_config.h file.&lt;/p&gt;
&lt;p&gt;NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL and&amp;nbsp;NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL&lt;/p&gt;
&lt;p&gt;This needs to fit the same parameters for your peripheral (they need to overlap).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An alternative, if you do not really care about the connection interval is to change something in your peripheral (if you have access to the source code for the peripheral).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking at the ble_app_uart (peripheral) example, in conn_params_init() in main.c, there is a parameter called cp_init which is used in ble_conn_params_init(&amp;amp;cp_init);&lt;/p&gt;
&lt;p&gt;Make sure that cp_init.disconnet_on_fail = false; if you don&amp;#39;t want the peripheral to disconnect if the connection parameters aren&amp;#39;t satisfied (according to the min and max connection interval settings).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&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: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/235003?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 17:02:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd40ea59-440d-408f-9ece-a13f7cc7ce27</guid><dc:creator>Ryan Lindeman (CAE)</dc:creator><description>&lt;p&gt;The Wireshark capture didn&amp;#39;t catch the Connection Parameter request being made by the Peripheral. But upon further review on Friday I discovered the Peripheral is making the request but my Python Central code is not sending an appropriate reply. I&amp;#39;m attempting to rework my Central code to fix this and will post my final results. I believe this is the source of the disconnect. One challenge is that this tends to come in during service discovery which prevents the Central from receiving the reply from the Peripheral. Does Nordic plan to fix the EvtSync method to address these timing issues in the driver?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/234968?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 14:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bca1274-ec2e-43a5-9179-50b9644e3087</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Sorry for the late reply.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you say ~63 seconds, could it be that it is 65 seconds? It sounds like that would be&amp;nbsp;FIRST_CONN_PARAMS_UPDATE_DELAY + 2 x NEXT_CONN_PARAMS_UPDATE_DELAY. However, I can&amp;#39;t see any parameter update requests in the sniffer trace. There should have been one approximately 5 seconds after the connection, and one after 30 seconds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, I see that it is the peripheral that decides to disconnect. Does the peripheral log say anything?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/234500?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2020 20:02:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d18a2fea-9911-4444-9a6a-8232316b9d2a</guid><dc:creator>Ryan Lindeman (CAE)</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/controller.py"&gt;devzone.nordicsemi.com/.../controller.py&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrftester.py"&gt;devzone.nordicsemi.com/.../nrftester.py&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Attached is the Python script which demonstrates the issue. Review the debug.log file produced.&lt;/p&gt;
&lt;p&gt;python nrftester.py COM4&lt;/p&gt;
&lt;p&gt;Using a nrf52832 development board as the central and probably peripheral. You will likely see what I see which is this line in the debug.log file:&lt;br /&gt;2020-02-14 12:58:11.706 INFO controller - remote_close: Connection closed after 64.07205009460449 seconds with reason BLEHci.remote_user_terminated_connection&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I believe that the Peripheral is initiating the close, but am unsure why. I have all of my sd_gap_disconnect code paths printing debug statements and I am not hitting any of them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to device using pc-ble-driver-py causes disconnect after 60 seconds</title><link>https://devzone.nordicsemi.com/thread/234284?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2020 00:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c2bf4aa-9a27-4be8-80ad-b0fcac9d4eda</guid><dc:creator>Ryan Lindeman (CAE)</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfConnect_2D00_no_2D00_disconnect.pcapng"&gt;devzone.nordicsemi.com/.../nrfConnect_2D00_no_2D00_disconnect.pcapng&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pc_2D00_ble_2D00_driver_2D00_py_2D00_disconnect.pcapng"&gt;devzone.nordicsemi.com/.../pc_2D00_ble_2D00_driver_2D00_py_2D00_disconnect.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Attached are two wireshark captures showing the difference. I will analyze them myself tomorrow but hopefully something in the capture might be helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>