<?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>Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65982/fail-to-change-connection-timeout</link><description>Hi, 
 I want to make the slave disconnect with the master in a minute automatically. 
 However, It&amp;#39;s failure when I have motified the codes like below: 
 
 Whatever I change NEXT_CONN_PARAMS_UPDATE_DELAY to xxx value, it doesn&amp;#39;t work. 
 Q: 
 1. What should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 24 Sep 2020 11:59:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65982/fail-to-change-connection-timeout" /><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/271322?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 11:59:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f1a649f-96ad-457e-81db-d1a165d1f616</guid><dc:creator>Yoole</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Karl said:
( you have not selected your device from the device menu, as shown in the included picture ).&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have. And I take the same steps to capture these trace.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/device_5F00_selected_2D00_1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Karl said:
In the other trace it seems that there is an abrupt end to the packet tranfers.
Is this trace taken while pairing / bonding with an iOS device?
It might be that the iOS devices wants to do the pairing procedure on 2 Mbps PHY, if possible.
What device are you using to do the sniffing, does it support 2 Mbps PHY?&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Android app named &lt;strong&gt;nRF connect. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sniffer version: nRF sniffer for BLE 5.0.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/100x75/__key/communityserver-discussions-components-files/4/7357.sniffer.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Karl said:
Furthermore, what security are you using for your connection?&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is this?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    ble_gatts_char_md_t char_md_rw;
    ble_gatts_attr_md_t cccd_md_rw;
    ble_gatts_attr_md_t attr_md_rw;
		
	memset(&amp;amp;cccd_md_rw, 0, sizeof(cccd_md_rw));
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md_rw.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md_rw.write_perm);
	cccd_md_rw.vloc = BLE_GATTS_VLOC_STACK;

    memset(&amp;amp;char_md_rw, 0, sizeof(char_md_rw)); 
		char_md_rw.char_props.read		= 1;  
		char_md_rw.char_props.write 	= 1;
		char_md_rw.char_props.notify	= 0;    
		char_md_rw.p_char_user_desc  = NULL;
		char_md_rw.p_char_pf         = NULL;
		char_md_rw.p_user_desc_md    = NULL;
		char_md_rw.p_cccd_md         = &amp;amp;cccd_md_rw;
		char_md_rw.p_sccd_md         = NULL;

	memset(&amp;amp;attr_md_rw, 0, sizeof(attr_md_rw)); 
    attr_md_rw.rd_auth = 1;
    attr_md_rw.wr_auth = 1;
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md_rw.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md_rw.write_perm);
    attr_md_rw.vloc = BLE_GATTS_VLOC_STACK;
    attr_md_rw.vlen = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Yoole&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/271304?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 11:28:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8348f79b-6ef2-42b6-a33e-ec71056ae842</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Yoole,&lt;/p&gt;
[quote user="Yoole"]Sth has come up, and time has been delayed.[/quote]
&lt;p&gt;I am sorry, but I do no understand what you mean by this.&lt;/p&gt;
[quote user="Yoole"]Following were two entire sniffer traces.&amp;nbsp;[/quote]
&lt;p&gt;Thank you for providing these traces.&lt;br /&gt;In one of the traces, it seems that you do not follow into the connection ( you have not selected your device from the device menu, as shown in the included picture ).&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-ae80d1d4bfb14fd693cd7c53030e49ff/wiresharkSourceDevice.PNG" /&gt;&lt;br /&gt;So, this trace did unfortunately did not provide so much information.&lt;br /&gt;&lt;br /&gt;In the other trace it seems that there is an abrupt end to the packet tranfers.&lt;br /&gt;Is this trace taken while pairing / bonding with an iOS device?&lt;br /&gt;It might be that the iOS devices wants to do the pairing procedure on 2 Mbps PHY, if possible.&lt;br /&gt;What device are you using to do the sniffing, does it support 2 Mbps PHY?&lt;br /&gt;Furthermore, what security are you using for your connection?&lt;br /&gt;&lt;br /&gt;I suspect that the connection might be terminated by either device, possibly because of a mismatch in either security or connection parameters.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/271015?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 09:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fac65e16-c7a7-483a-af66-96488ee296ee</guid><dc:creator>Yoole</dc:creator><description>&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;Hi Karl,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Sth has come up, and time has been delayed.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Following were two entire sniffer traces.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp; &amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0216.std_5F00_beacon_5F00_connection_5F00_detail_2D00_1.pcapng"&gt;devzone.nordicsemi.com/.../0216.std_5F00_beacon_5F00_connection_5F00_detail_2D00_1.pcapng&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5383.std_5F00_beacon_5F00_connection_5F00_detail_2D00_2.pcapng"&gt;devzone.nordicsemi.com/.../5383.std_5F00_beacon_5F00_connection_5F00_detail_2D00_2.pcapng&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; In&amp;nbsp;std_beacon_connection_detail-1 and xxx-2 trace, I just use Android app, NRF CONNECT, to connect the module and wait for the disconnection happened.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; The behavior can be seen&amp;nbsp; in &lt;strong&gt;&lt;em&gt;std_beacon_connection_detail-1&lt;/em&gt;&lt;/strong&gt; in the exchange starting at packet 20, with a sudden disconnect/termination of the link at packet 50.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; The similarity with &lt;strong style="color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:bold;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;em&gt;std_beacon_connection_detail-1&lt;/em&gt;&lt;/strong&gt;, xxx-2 begins at packet 12 and stops at packet 16.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;BR,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Yoole&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/270532?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 09:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd8e3f16-3fc0-471d-96e7-5f2cd9b85936</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Yoole,&lt;/p&gt;
[quote user="Yoole"]Happy weekend.[/quote]
&lt;p&gt;Thank you, I hope your weekend was great as well!&lt;/p&gt;
[quote user="Yoole"]Android(nRF connect app) and IOS(nRF connect app) has diffent numbers, the former is about 40 seconds and the latter is about 30 seconds.[/quote]
&lt;p&gt;This could indicate that the connection is closed by the central after some time, and that the two different centrals have different timeout intervals / requirements for closing the connection. We will have to take a look at the sniffer trace to see what the case is here, exactly.&lt;/p&gt;
[quote user="Yoole"]Yes, I have placed a breakpoint on the switch statement. But&amp;nbsp;BLE_GAP_EVT_DISCONNECTED was not triggered when disconnection happened.[/quote]
&lt;p&gt;Debugging with breakpoints is not straight-forward when the SoftDevice is enabled and in a connection, because the constant haling of the CPU will break the connection every time.&lt;br /&gt;Take a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/9622/application-debug-with-softdevice/35565#35565"&gt;the answer by my colleague Susheel in this ticket&lt;/a&gt;.&lt;br /&gt;To avoid having to make these changes to be able to debug ( when you are just looking to see if the code enters a certain code block ) I would recommend adding a logging output instead, for convenience.&lt;/p&gt;
[quote user="Yoole"]After the packets capturing, I noticed that the connection state has been something wrong. There&amp;#39;s no services and characteristics responded. Is this the causes of abnormal disconnection?[/quote]
&lt;p&gt;It is very hard to say from looking at this small sniffer exempt, but there are no disconnect initiated here, as far as I can see.&lt;br /&gt;Please upload the entire sniffer trace, and write out what you are doing when the different exchanges happen: &amp;quot;The behavior can be seen in the exchange starting at packet 140, with a sudden disconnet / termination of the link at packet 200&amp;quot;, for example.&lt;br /&gt;This enables me to see what is really going on in the link, while at the same time not having to weed through potentially thousands of packets.&lt;br /&gt;&lt;br /&gt;Looking forward to resolving this issue together!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/270451?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 06:34:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e65d1460-11b5-4457-8d82-125c06ea7075</guid><dc:creator>Yoole</dc:creator><description>&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;Hi Karl,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Happy weekend.&lt;br /&gt;&amp;nbsp;&amp;nbsp; Not so exactly. I take a simple test by second chronograph. Android(nRF connect app) and IOS(nRF connect app) has diffent numbers, the former is about 40 seconds and the latter is about 30 seconds.&lt;/span&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="background-color:#ffffff;"&gt;I am not sure I understand what you mean here - are you saying that no disconnected event is received by the application?&lt;br /&gt;Are you attempting to see this by placing a breakpoint on the switch statement itself? You should rather place it within the case you would like to check.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Yes, I have placed a breakpoint on the switch statement. But&amp;nbsp;BLE_GAP_EVT_DISCONNECTED was not triggered when disconnection happened.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; After the packets capturing, I noticed that the connection state has been something wrong. There&amp;#39;s no services and characteristics responded. Is this the causes of abnormal disconnection?&lt;/span&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3554.capture.png" /&gt;&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Do you have some solutions to handle this issue?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;BR,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Yoole&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/269983?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2020 06:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fab981e-2c44-413c-bdc5-c2537da4c672</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again Yoole,&lt;/p&gt;
[quote user="Yoole"]Thanks for your reply.[/quote]
&lt;p&gt;It is not problem at all, I am happy to help!&lt;/p&gt;
[quote user="Yoole"]Here is a strange performance, I connect the module(slave) with iPhone11(master) and the connection will be disconnected automatically in about 30 seconds.[/quote]
&lt;p&gt;That does sound strange. Is it exactly 30 seconds?&lt;br /&gt;Does the phone provide you with any information about the disconnection? Are you connecting to the your device using the OS Bluetooth settings, or are you using an application on the phone?&lt;/p&gt;
[quote user="Yoole"]When I debug to check disconnected event,&amp;nbsp; I cannot find that &amp;quot;&lt;span style="background-color:#ffffff;"&gt;&lt;strong&gt;p_ble_evt-&amp;gt;header.evt_id&lt;/strong&gt;&amp;quot; was called in &amp;quot;&lt;strong&gt;ble_evt_handler&lt;/strong&gt;&amp;quot;.&lt;/span&gt;[/quote]
&lt;p&gt;I am not sure I understand what you mean here - are you saying that no disconnected event is received by the application?&lt;br /&gt;Are you attempting to see this by placing a breakpoint on the switch statement itself? You should rather place it within the case you would like to check.&lt;br /&gt;&lt;br /&gt;The &amp;quot;sure-fire&amp;quot; way to find out what is happening here is to use the &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE"&gt;nRF Sniffer tool&lt;/a&gt;. Are you familiar with the nRF Sniffer?&lt;br /&gt;It is a very powerful tool when developing with BLE, since it lets you monitor all the on-air BLE traffic. Seeing this, we could verify whether the disconnection is caused by a deliberate termination by one of the devices, or if the connection times out, etc.&lt;br /&gt;&lt;br /&gt;Looking forward to resolving this issue together!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/269973?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2020 02:25:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:657707ff-0779-4883-b3d9-0767b27e47b8</guid><dc:creator>Yoole</dc:creator><description>&lt;p&gt;Hi Karl，&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Thanks for your reply.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Here is a strange performance, I connect the module(slave) with iPhone11(master) and the connection will be disconnected automatically in about 30 seconds. When I debug to check disconnected event,&amp;nbsp; I cannot find that &amp;quot;&lt;span style="background-color:#ffffff;"&gt;&lt;strong&gt;p_ble_evt-&amp;gt;header.evt_id&lt;/strong&gt;&amp;quot; was called in &amp;quot;&lt;strong&gt;ble_evt_handler&lt;/strong&gt;&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; On account of the auto-disconnection, I have no means to use &lt;strong&gt;app_timer&lt;/strong&gt; to revise that timeout.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; Can I have your analysis?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;BR,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Yoole&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fail to change connection timeout.</title><link>https://devzone.nordicsemi.com/thread/269861?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2020 12:15:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22f2a35b-af41-416b-b748-8c4357c12772</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Yoole,&lt;br /&gt;&lt;br /&gt;There might be a mismatch in what you want to achieve and what you are changing here.&lt;br /&gt;First of all, I see no mention of which setting you have changed to a minute in the code.&lt;/p&gt;
[quote user=""]NEXT_CONN_PARAMS_UPDATE_DELAY [/quote]
&lt;p&gt;This is the delay before the peripheral requests to update the parameters of the connection, to suit the peripherals requirements. This is not how you initiate a disconnection of the link.&lt;br /&gt;The timeout supervision is used to set how long the device will keep the connection live when it does not hear anything from its peer. So, for example, the central will not report the link as broken even though it has not heard anything until the supervision times out.&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt; Q:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&amp;nbsp; 1. What should I do to make the slave disconnecting automatically in a minute?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you would like the connection to be terminated after a given time, you can use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.0.1%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga4031d0e4034c6f5900ad6d35b763fb0d"&gt;sd_ble_gap_disconnect&lt;/a&gt;&amp;nbsp;function, in connection to a timer ( such as the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_timer.html"&gt;app_timer&lt;/a&gt; ).&lt;br /&gt;So, to disconnect after 60 seconds, you should set up a timer which is started on the CONNECTED event, and have the disconnect function called in the timer&amp;#39;s expiration handler.&lt;br /&gt;&lt;br /&gt;Please do not hesitate to ask if anything should be unclear, or if you should encounter any other issues or questions.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>