<?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>Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41267/multi-role-in-sdk-15---scanning-for-devices-only-working-when-peripheral-is-not-connected</link><description>Hi, 
 I&amp;#39;m trying to get the scanning procedure to work while my device is connected to a phone. At the moment, even though I start the scanning procedure, I don&amp;#39;t get any BLE_GAP_EVT_ADV_REPORT events. 
 As soon as the peripheral link is terminated (i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Dec 2018 18:23:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41267/multi-role-in-sdk-15---scanning-for-devices-only-working-when-peripheral-is-not-connected" /><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/162163?ContentTypeID=1</link><pubDate>Mon, 17 Dec 2018 18:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa1f7654-1d1b-42cd-a699-b8bd8564489f</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Not that I&amp;#39;m aware of. I&amp;#39;ll close this thread since I don&amp;#39;t really have more questions about it. Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/162155?ContentTypeID=1</link><pubDate>Mon, 17 Dec 2018 17:10:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f39ab0a0-c34b-48bf-831b-4959145677ac</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That sounds a bit strange, but it looks like that would be the case, yes. Had you set up your iPhone to advertise, through an app or otherwise?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161899?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 14:50:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcbb2fce-75e1-41c5-a326-cb4f7e5136d4</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Ok, that makes sense. But then since my only connection was an iPhone, that would mean that the iPhone was advertising and then I got an adv report from the iPhone?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161896?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 14:45:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1fd2693-f57f-4b73-81a6-f86ce33ddd71</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, that would probably explain it. In the latest SoftDevice you need to actively resume scanning on an advertising report, so just returning from the handler would leave the SoftDevice in a state where scanning is &amp;quot;paused&amp;quot;.&lt;/p&gt;
&lt;p&gt;As to why you could receive an advertising report from a device to which you are already in a connection, that would be normal if the other device can have multiple connections as a peripheral. It would then continue to advertise again after the connection with your central device was established.&lt;/p&gt;
&lt;p&gt;In order to not end up with multiple connections to the same peripheral it is wise to do that check, but with SoftDevice 6 and onward you must make sure to restart scanning before you return from the handler.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161635?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 10:32:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be07e438-6fdd-4289-bdc9-09efd248a184</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I found the problem! It&amp;#39;s this code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void on_adv_report(ble_evt_t const * p_ble_evt) {
	ble_gap_evt_t const * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;
	ret_code_t            err_code;
	
	if (is_already_connected(&amp;amp;p_gap_evt-&amp;gt;params.adv_report.peer_addr)) {
		debug_line(&amp;quot;Returning because already connected&amp;quot;);
		return;
	}
	.
	.
	.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why I had that there. I possibly copied it from one of the examples. My question now is: Why would an advertising report come from a device that is already connected? That doesn&amp;#39;t make sense at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161621?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 09:51:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9999135f-c297-4f6e-ac9b-ce5b055d3b37</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I just tried what you suggested, i.e. scanning with a single configuration supporting one peripheral and on e central link, and it didn&amp;#39;t work either. So at least that means that the configuration isn&amp;#39;t the problem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161469?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 14:00:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcfa7bcb-54ec-4baa-a830-73c9b25808e7</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The suggestion to look at the connection intervals was because scan events are dropped in their entirety if they collide with connection events. (That would explain why you did not get any advertising reports.) But if scan events are dropped multiple times and the connections have high enough supervision timeout (and, in peripheral role, slave latency) then after a few missed scan event a scan event would be scheduled anyway (and the connection event be dropped instead.) However, with the parameters that you listed I do not see how this could be the issue. Also, in that case you should expect at least _some_ scan events to get thorugh.&lt;/p&gt;
&lt;p&gt;Have you gotten the scan and establishment of a second connection to work if you use the same configuration for both links? The issues that you experience may be totally unrelated to the use of different configurations.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161067?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 16:45:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:037b61de-6cf8-4d59-9434-b3dfec0bd65b</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;The connection parameters of my central links are set to 500 ms min, 2000 ms max, but the scanning doesn&amp;#39;t even work when no central links are active (i.e. peripheral active, no central links active).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161065?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 16:44:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ea1dfa9-1e61-4bae-8919-b3a6286add3e</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I just tried a configuration similar to the one in the Relay example, i.e. 100 ms interval, 50 ms window, and it also didn&amp;#39;t work. I don&amp;#39;t even understand how those parameters would even work on a 7.5 ms - 30 ms connection interval (in the example).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/161060?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 16:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3a7a2df-9d35-4f5d-8803-3a46a7b4afd2</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I played around with the scanning parameters but didn&amp;#39;t get anywhere.&lt;/p&gt;
&lt;p&gt;I have a peripheral with a connection interval between 15 (minimum) and 30 ms (maximum), most times it is 30 ms. I have tried different scanning parameters with no success. Any recommendations?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160947?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 11:34:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44d47fab-a55f-46da-be3e-ca294bc4292d</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Hi tesc,&lt;/p&gt;
&lt;p&gt;I do have a setup that supports simultaneous peripheral and central connections, but I&amp;#39;m not sure if my setup is correct:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Configure the maximum number of connections.
memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
ble_cfg.gap_cfg.role_count_cfg.periph_role_count  = NRF_SDH_BLE_PERIPHERAL_LINK_COUNT;
ble_cfg.gap_cfg.role_count_cfg.central_role_count = NRF_SDH_BLE_CENTRAL_LINK_COUNT;
ble_cfg.gap_cfg.role_count_cfg.central_sec_count  = NRF_SDH_BLE_CENTRAL_LINK_COUNT;
err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &amp;amp;ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);

// Configure peripheral links.
// Configure the maximum ATT MTU.
memset(&amp;amp;ble_cfg, 0x00, sizeof(ble_cfg));
ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = NRF_SDH_BLE_GATT_MAX_MTU_SIZE;
ble_cfg.conn_cfg.conn_cfg_tag                 = PERIPHERAL_CONN_CFG_TAG;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATT, &amp;amp;ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);

// Configure GAP connections.
memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count     = 1;
ble_cfg.conn_cfg.params.gap_conn_cfg.event_length   = NRF_SDH_BLE_GAP_EVENT_LENGTH;
ble_cfg.conn_cfg.conn_cfg_tag                       = PERIPHERAL_CONN_CFG_TAG;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &amp;amp;ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);

// Configure central links.
// Configure the maximum ATT MTU.
memset(&amp;amp;ble_cfg, 0x00, sizeof(ble_cfg));
ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = 23;
ble_cfg.conn_cfg.conn_cfg_tag                 = CENTRAL_CONN_CFG_TAG;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATT, &amp;amp;ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);

// Configure GAP connections.
memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count     = NRF_BLE_LINK_COUNT;
ble_cfg.conn_cfg.params.gap_conn_cfg.event_length   = NRF_SDH_BLE_GAP_EVENT_LENGTH;
ble_cfg.conn_cfg.conn_cfg_tag                       = CENTRAL_CONN_CFG_TAG;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &amp;amp;ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Basically I have one configuration that supports just one peripheral connection with MTU 247, and one configuration that supports 1&amp;nbsp;peripheral connection and 3 central connections with MTU 23. I did this due to RAM restrictions.&lt;/p&gt;
&lt;p&gt;I guess it might be that once the peripheral connects first, it stays using the first configuration? How can I make it so that the second configuration is used? Do I need to advertise with the second configuration tag?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160793?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 15:57:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b3c8ebe-8d71-48d8-b7d2-4b702f4e39d9</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should be able to still scan, even if you still have one connection as peripheral and one connection as central, provided that you have configured the SoftDevice to have (at least) one connection as peripheral and two connections as central.&lt;/p&gt;
&lt;p&gt;May it be that your timing requirements on the existing connections means those will get priority over the scan events, so that most (of all) of the scan requests gets dropped? See &lt;a href="https://www.nordicsemi.com/DocLib/Content/SoftDevice_Spec/s132/latest/SDS/s1xx/multilink_scheduling/priorities_and_events_intro"&gt;SoftDevice timing-activities and priorities&lt;/a&gt;. What are the connection parameters for the existing links, both as peripheral and as central?&lt;/p&gt;
&lt;p&gt;You can also have a look at the &lt;a href="https://www.nordicsemi.com/en/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/ble_sdk_app_rscs_relay"&gt;Experimental: BLE Relay Example&lt;/a&gt;, which scans for and connects to two peripherals, as well ass acts as peripheral in a connection to a central. As such it looks like the perfect reference example for your use case.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160462?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:30:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:433e803d-5b87-4bc9-819d-8fed6bea3aef</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;My device is a peripheral that connects to a mobile app. It should be able to scan and connect to third-party accessories. I already have multiple concurrent connections working, i.e. my device connected to a phone using a peripheral link, and my device connected to multiple accessories using central links.&lt;/p&gt;
&lt;p&gt;However, apparently I can only scan for accessories while the peripheral link is not active.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160461?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:26:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9be8753c-2021-4480-9148-8b633a4674a4</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I think you need to give a fuller explanation of what, exactly, is going on.&lt;/p&gt;
&lt;p&gt;What, exactly, is &amp;quot;your device&amp;quot; ?&lt;/p&gt;
&lt;p&gt;What is doing the advertising?&lt;/p&gt;
&lt;p&gt;A diagram would help ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160460?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02cf037c-41db-4dd2-932e-8e46235b88bd</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;There are plenty of devices advertising around me. My phone can see at least 10. I expect my device to be able to scan for these devices while it is connected to my phone.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160459?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:24:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:236d3602-4cf2-4c54-8ba7-c1efceab1145</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I know.&lt;/p&gt;
&lt;p&gt;But the scanning won&amp;#39;t detect any advertising when there&amp;#39;s no advertising happening!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160458?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06abe0e9-f39d-4fca-ba2b-e5f265afc65c</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I said scanning, not advertising.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multi role in SDK 15 - Scanning for devices only working when peripheral is not connected</title><link>https://devzone.nordicsemi.com/thread/160454?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 17:13:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e083b12-7aa5-4f53-af2c-000cd459ac51</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;This is the expected, normal behaviour - peripherals don&amp;#39;t advertise while they are connected!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>