<?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>Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset</link><description>I have a device that runs NCS 2.0.2 on an nrf5340 and have an occasional issue with service discovery. 
 I have recently found that after calling sys_reboot() on my device, during the first BLE connection after the reboot my device will fail to discover</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 May 2024 12:25:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset" /><item><title>RE: Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/thread/481544?ContentTypeID=1</link><pubDate>Thu, 02 May 2024 12:25:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ceef2c5-e9bf-4491-a5a5-6d7e6f96abbf</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;That is odd. Let&amp;#39;s have a closer look at the communicaiton and see if we can understand what goes wrong.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="margin:0;padding:0;text-align:left;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="margin:0;padding:0;text-align:left;"&gt;Can you capture a sniffer log and upload it here as a pcap file using Insert -&amp;gt; Image/video/file? See &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le" rel="noopener noreferrer" target="_blank"&gt;Bluetooth Low Energy nRF Sniffer for Bluetooth LE&lt;/a&gt; for how to set up and use our Bluetooth Low Energy sniffer.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/thread/481171?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2024 18:11:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e1dc0b7-e1f6-481b-9c6b-102f41cd12bc</guid><dc:creator>ereksonr</dc:creator><description>&lt;p&gt;I was able to test this out today. Unfortunately it does not fix the issue&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/thread/480334?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 06:48:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa608205-00e2-4376-8ba0-dea15591ab72</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Try to increase &lt;code&gt;CONFIG_BT_RX_STACK_SIZE&lt;/code&gt;, for example to &lt;code&gt;4096&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Does that help?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/thread/480248?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 14:22:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a1fb005-4ac0-4428-b6cb-1b160a5eb13b</guid><dc:creator>ereksonr</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset/480200"]How long is it between the reboot and the connection?[/quote]
&lt;p&gt;It is about 1 minute from the reboot until a connection is attempted.&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset/480200"]What happens if you delay the connection 10 seconds?[/quote]
&lt;p&gt;Varying timing does not seem to have an effect. I have waited as long as 2 minutes before beginning advertisements to establish the connection&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset/480200"]Are you able to debug the problem and find exactly the line showing &amp;quot;return ENOMEM&amp;quot;?[/quote]
&lt;p&gt;ENOMEM appears to be coming from line 2264 of gatt.c:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="background-color:#e0e0e0;color:#000000;"&gt;&lt;code&gt;req = gatt_req_alloc(func, params, encode, op, len);&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#e0e0e0;color:#000000;"&gt;&lt;code&gt; if (!req) {&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#e0e0e0;color:#000000;"&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; return -ENOMEM;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#e0e0e0;color:#000000;"&gt;&lt;code&gt; }&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If I trace this down further, it appears to be a call to k_mem_slab_alloc() on line 3428 of att.c that times out, causing the error.&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/110477/current-time-service-discovery-failing-in-first-connection-after-reset/480200"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;This appears to be linked to the configuration &amp;quot;CONFIG_BT_L2CAP_TX_BUF_COUNT&amp;quot;.&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;How do these appear to be linked?&lt;/p&gt;[/quote]
&lt;p&gt;the k_mem_slab_alloc() call is allocating space from &amp;quot;req_slab&amp;quot;, the size of which is defined by&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_L2CAP_TX_BUF_COUNT&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Current Time Service Discovery Failing in First Connection After Reset</title><link>https://devzone.nordicsemi.com/thread/480200?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 12:16:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04c811c8-bf9a-4cbb-b584-52b74abb5f7d</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I have recently found that after calling sys_reboot() on my device, during the first BLE connection after the reboot my device will fail to discover the current time service on the Central device. Subsequent connections have no issue with discovering the service.[/quote]
&lt;p&gt;How long is it between the reboot and the connection?&lt;br /&gt;What happens if you delay the connection 10 seconds?&lt;/p&gt;
[quote user=""]If I then re-attempt discovery, bt_gatt_dm_start() returns -12 (ENOMEM).[/quote]
&lt;p&gt;Are you able to debug the problem and find exactly the line showing &amp;quot;return ENOMEM&amp;quot;?&lt;/p&gt;
[quote user=""]This appears to be linked to the configuration &amp;quot;CONFIG_BT_L2CAP_TX_BUF_COUNT&amp;quot;.[/quote]
&lt;p&gt;How do these appear to be linked? &lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>