<?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>Softdevice couldn&amp;#39;t initiate connection successfully</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81264/softdevice-couldn-t-initiate-connection-successfully</link><description>Hi, 
 I am developing a product based on nrf52840 soc as a central Bluetooth device. I want to connect to a Bluetooth device (as a slave) while it is advertising, but unfortunately, the process fails as the salve doesn&amp;#39;t respond to the exchange MTU request</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Nov 2021 13:33:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81264/softdevice-couldn-t-initiate-connection-successfully" /><item><title>RE: Softdevice couldn't initiate connection successfully</title><link>https://devzone.nordicsemi.com/thread/337109?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2021 13:33:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dbf69fc-6370-4491-86a6-16c5e7a88a90</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Is there any other places in the application you may call something that updates the MTU? E.g. somewhere in main.c?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="alireza sadeghpour"]1) what is the LL_FEATURE_REQ and is there any way to send that request with the soft device?[/quote]
&lt;p&gt;I don&amp;#39;t think that is an active application call. I think the softdevice does this by itself.&amp;nbsp;&lt;/p&gt;
[quote user="alireza sadeghpour"]2) the slave device has two modes,&amp;nbsp;connection, and pairing mode. in the&amp;nbsp;connection mode, LE_General_Discoverable flag in the adverting data is false and in the pairing mode,&amp;nbsp;&lt;span&gt;LE&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;General&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;Discoverable&amp;nbsp;&lt;/span&gt;flag in the advertising data is true.[/quote]
&lt;p&gt;I am not sure I understand correctly. What do you mean with &amp;quot;slave doesn&amp;#39;t respond to us&amp;quot;? You are not able to connect? Are you bonded?&lt;/p&gt;
[quote user="alireza sadeghpour"]3) can connection parameters like timeout or window size cause this problem?[/quote]
&lt;p&gt;That is a wide question. The connection parameters can be quite complex, at least if you take the advertising parameters into account. But connection interval etc. should be fine, I guess.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="alireza sadeghpour"]4) in the trace,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8686.nrf52840_5F00_trace.pcapng"&gt;5305.nrf52840_trace.pcapng&lt;/a&gt;&amp;nbsp;you&amp;#39;ve seen that softdevice tries 6 time to send MTU and then terminates the connection. is there any way to increase 6 to 16 and then when slave dosen&amp;#39;t respond softdevice terminates the connection?[/quote]
&lt;p&gt;You can try to increase the connection supervision timeout, but I think we should focus on figuring out why the central sends these messages so soon, and doesn&amp;#39;t behave more like the other sniffer trace. Do you know? Is there any way for me to reproduce this using one or more DKs? I suspect that your application is doing this on it&amp;#39;s own, and before it should. It is not from the file that you sent in the previous reply. Perhaps you are calling something from your main.c file?&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: Softdevice couldn't initiate connection successfully</title><link>https://devzone.nordicsemi.com/thread/336936?ContentTypeID=1</link><pubDate>Mon, 01 Nov 2021 18:38:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed4ddb35-4bfc-498a-b1d2-9d400df59f5b</guid><dc:creator>alireza sadeghpour</dc:creator><description>&lt;p&gt;excuse me for the delay,&lt;/p&gt;
&lt;p&gt;our MTU always was 517.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve changed the MTU to 247, but it doesn&amp;#39;t work again. (you can see it in the attached sniff log in packet 1277).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve sme questoin:&lt;/p&gt;
&lt;p&gt;1) what is the LL_FEATURE_REQ and is there any way to send that request with the soft device?&lt;/p&gt;
&lt;p&gt;2) the slave device has two modes,&amp;nbsp;connection, and pairing mode. in the&amp;nbsp;connection mode, LE_General_Discoverable flag in the adverting data is false and in the pairing mode,&amp;nbsp;&lt;span&gt;LE&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;General&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;Discoverable&amp;nbsp;&lt;/span&gt;flag in the advertising data is true.&lt;/p&gt;
&lt;p&gt;in the pairing mode, we can connect and communicate with the device as expected (in the&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5305.nrf52840_5F00_trace.pcapng"&gt;5305.nrf52840_trace.pcapng&lt;/a&gt;&amp;nbsp;trace packet 4981 you can see a connection established successfully).&lt;/p&gt;
&lt;p&gt;do you see any point in that? when the&amp;nbsp;&lt;span&gt;LE&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;General&lt;/span&gt;&lt;span&gt;_&lt;/span&gt;&lt;span&gt;Discoverable is true everything works but when that flag is&amp;nbsp;false&amp;nbsp;slave doesn&amp;#39;t respond to us.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3) can connection parameters like timeout or window size cause this problem?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4) in the trace,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5305.nrf52840_5F00_trace.pcapng"&gt;5305.nrf52840_trace.pcapng&lt;/a&gt;&amp;nbsp;you&amp;#39;ve seen that softdevice tries 6 time to send MTU and then terminates the connection. is there any way to increase 6 to 16 and then when slave dosen&amp;#39;t respond softdevice terminates the connection?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks for your attention&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/At-with-MTU.pcapng"&gt;devzone.nordicsemi.com/.../At-with-MTU.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice couldn't initiate connection successfully</title><link>https://devzone.nordicsemi.com/thread/336890?ContentTypeID=1</link><pubDate>Mon, 01 Nov 2021 13:47:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:968306a0-572b-42d9-b25d-66d74d39bdfa</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What was the MTU size before you changed it, and was it working before you changed it? Can you try to set it to 247, does it work then?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice couldn't initiate connection successfully</title><link>https://devzone.nordicsemi.com/thread/336858?ContentTypeID=1</link><pubDate>Mon, 01 Nov 2021 12:38:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fab0593d-1389-4abb-abc1-19053ca32280</guid><dc:creator>alireza sadeghpour</dc:creator><description>&lt;p&gt;Thanks for your attention,&lt;/p&gt;
&lt;p&gt;Yes, the central device is my nrf52850 and nrf52840_trace.pcapng is the sniffer trace when the connection hangs.&lt;br /&gt;I can&amp;#39;t change the peripheral side as it is a ready product from authentrend company.&lt;/p&gt;
&lt;p&gt;Actually, I&amp;#39;ve just changed the NRF_SDH_BLE_GATT_MAX_MTU_SIZE to the 517 in the sdk_config.h and in the nrf_ble_gatt.c which is from the nordic SDK, in the on_connected_evt function, if the desired mtu was bigger than the effective mtu, calls the sd_ble_gattc_exchange_mtu_request function. in the attached file, in line 151 you can see this code snippet.&lt;/p&gt;
&lt;p&gt;is it safe to remove this from the nrf_ble_gatt.c and call it manually?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf_5F00_ble_5F00_gatt.c"&gt;devzone.nordicsemi.com/.../nrf_5F00_ble_5F00_gatt.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;sincerely&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice couldn't initiate connection successfully</title><link>https://devzone.nordicsemi.com/thread/336823?ContentTypeID=1</link><pubDate>Mon, 01 Nov 2021 10:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8f37d03-284e-404d-8c22-62fdf95dde41</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So the central device in your nrf52840_trace.pcapng is the device you are working on, correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If so, how do did you call the MTU update on this device? Perhaps you can show some code snippets? I guess if you want this to be persistent across all devices, you can initiate it from the peripheral, if you are developing that one as well. If not, I suggest you look into having this in the connected event. If this is what you are doing already, perhaps you need to add a delay. I see from the sniffer trace that the central is asking for an MTU update immediately after the connection request, which seems a bit off. The peripheral didn&amp;#39;t event respond to the connection request yet. Did you call it from the BLE_GAP_EVT_CONNECTED event?&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></channel></rss>