<?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>nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114125/nrf5340---peripheral-disconnection-because-out-of-range</link><description>Hi, I&amp;#39;m working on nRF5340 Bluetooth LE peripheral (building environment: NCS 2.6.1, Zephyr 3.5.99). The net core is populated with the Zephyr HCI RPMsg sample LE Controller as it is. I experience a disconnection from peer with reason BT_HCI_ERR_CONN_TIMEOUT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Sep 2024 12:25:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114125/nrf5340---peripheral-disconnection-because-out-of-range" /><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/501927?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 12:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfaee6a8-63cd-4c7e-b443-47087171abb3</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Gabriele&lt;/p&gt;
&lt;p&gt;Okay I see. I think it would be easier for you to follow my colleague Susheel&amp;#39;s advice in&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/114174/nrf52840-ncs-2-5-0---ncs-2-7-0-ble-advertising-stops-on-disconnect/499731"&gt; this ticket&lt;/a&gt;, as you will have a lower downtime if you do one of the suggestions there:&lt;/p&gt;
&lt;p&gt;a) Change CONFIG_BT_MAX_CONN to 2 and allow an overlap of roles&lt;/p&gt;
&lt;p&gt;b) Create a worker thread to start the advertising as the disconnect callback has exited.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/501682?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 09:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29b878cd-fd7f-46b0-9f89-6dc154ca318f</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;That&amp;#39;s correct.&lt;/p&gt;
&lt;p&gt;The disconnection callback already has a function for restarting advertising. Usually it works fine. What is missing is a function that&amp;nbsp;aborts&amp;nbsp;any pending transmission of data.&amp;nbsp;How to do that ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/501680?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 09:33:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dba1624-1d30-474d-8156-d0033e19a1f7</guid><dc:creator>Simonr</dc:creator><description>[quote user="gabrielef@cosmed.it"]I think that advertising should restart before the central peer could re-connect[/quote]
&lt;p&gt;Yes, that&amp;#39;s correct, but it seems like your application tries sending data instead of starting advertising. After a disconnect occurs I recommend you add a function that starts advertising again and quit the transmissions of data that should be done in a connection.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/501525?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 11:24:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36df86d8-c07e-4e24-9000-aa73a5801fa7</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Hi Simonr&lt;/p&gt;
&lt;p&gt;I think that advertising should restart before the central peer could re-connect. I want the device be able to restart the advertising regularly&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/501299?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 08:27:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54d5280d-692f-4a51-a0ab-f3fd4ac2c4c9</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Gabriele&lt;/p&gt;
&lt;p&gt;Sorry, but what function are you referring to failing to send data here exactly? From the log, the error seems to come after the advertising fails to start and reporting that the devices are not connected, so I guess you first of all need to reconnect before trying to restart sending data between the devices.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/500835?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2024 16:20:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57914a7f-5557-40fb-814e-df223907e227</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;this way seems a bit overkilling.&lt;br /&gt;My goal is to ensure the BLE data transmission from peripheral to central restarts seamlessly upon reconnection.&lt;br /&gt;The data transmit function I use is defined in module cp.c like this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int bt_cp_send(struct bt_conn *conn, uint8_t *data, uint16_t len)
{
  int ret;
  struct bt_gatt_notify_params params = {0};
  const struct bt_gatt_attr *attr = &amp;amp;css_svc.attrs[7];

  params.attr = attr;
  params.data = data;
  params.len = len;
  params.func = on_sent_cp;

  if (!conn) {
    ret = bt_gatt_notify_cb(NULL, &amp;amp;params);
  } else if (bt_gatt_is_subscribed(conn, attr, BT_GATT_CCC_NOTIFY)) {
    ret = bt_gatt_notify_cb(conn, &amp;amp;params);
  } else {
    return -EINVAL;
  }

  return ret;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Right after a disconnection event due to out of range condition, the function returns -128.&lt;br /&gt;I get on the console&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:01:22.337,493] &amp;lt;inf&amp;gt; bas: BAS Notifications disabled
[00:01:22.343,231] &amp;lt;inf&amp;gt; cp: BT CP notify is DISABLED
[00:01:22.349,578] &amp;lt;wrn&amp;gt; ble: disconnected from peer 00:E0:4C:32:98:9B (public) [reason: 0x08]
[00[00:01:22.373,229] &amp;lt;err&amp;gt; ble: advertising failed to start [-12]
:01:22.371,948] &amp;lt;wrn&amp;gt; bt_att: Not connected
[00:01:22.387,847] &amp;lt;err&amp;gt; cp: BT CP failed to send data [-128]&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;At 4th line something gets broken, preventing the advertising to restart clean.&lt;br /&gt;I need to restart advertising to allow a reconnection when the peers get back in range.&lt;br /&gt;Is there a specific action to take upon disconnection in order to avoid this situation ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - peripheral disconnection because out of range</title><link>https://devzone.nordicsemi.com/thread/499525?ContentTypeID=1</link><pubDate>Fri, 23 Aug 2024 11:05:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a820cde-fa0f-4020-8775-01bcb6abbcd0</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You should be able to get a warning of the connection status by implementing the QoS reports in your application, Please check out the Quality of Service library in NCS available here:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/others/qos.html#quality-of-service"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/others/qos.html#quality-of-service&lt;/a&gt;. You should be able to make the application put out a warning if the quality goes below a set threshold.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>