<?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>nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82592/nrf52-dual-role-while-connected-as-central-and-scanning-connection-as-peripheral-fails</link><description>We have an nRF52 with dual roles: peripheral for the connection to an app, and central, connecting to multiple third party peripheral devices. 
 We have come across a very weird issue - it took a while to reproduce, but here it is: 
 If our device as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Dec 2021 11:25:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82592/nrf52-dual-role-while-connected-as-central-and-scanning-connection-as-peripheral-fails" /><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343868?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 11:25:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5552f5ea-ebe3-4a0d-867a-7d7fc53afd22</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;That seems like a needle in a haystack, as I have no indication of the conditions needed for the issue nor what causes it. But if you are able to reproduce it with code that I can run on a DK let me know and share the code, and I will dig into it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343867?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 11:22:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f5aba47-77b4-45b0-9b69-f9e9dbe29efd</guid><dc:creator>thefool</dc:creator><description>&lt;p&gt;I haven&amp;#39;t actually tested with example projects - all our&amp;nbsp;DKs are currently with employees in home-office, or configured as sniffers -&amp;nbsp;I was suggesting you might be able to&amp;nbsp;test it ;-)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I did test the nRF Connect app with our devices, just to confirm it has nothing to do with our iOS app.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343862?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 11:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98b8188-7344-416b-b18b-aad2e83dda1f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;That is interesting. Can you upload the example projects&amp;nbsp;with your modifications here so that I can test them on my end?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343853?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 10:59:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d7fd5df-310c-4574-847c-f692e0b0f27d</guid><dc:creator>thefool</dc:creator><description>&lt;p&gt;I think I actually just managed to work around the bug by stopping scanning as soon as possible when we get a connection to our peripheral role.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Still I&amp;#39;d like to understand if this is a bug in the softdevice, and/or what the reasoning behind this is.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I guess&amp;nbsp;it would be worth, checking if&amp;nbsp;you can&amp;nbsp;reproduce the setup with example projects. &lt;br /&gt;Instead of our Holux:&amp;nbsp;One Blinky with preferred connection parameters:&amp;nbsp;min: 320 (400ms),&amp;nbsp;max: 520 (650ms),&amp;nbsp;latency: 0,&amp;nbsp;sup_timout: 400 (4000ms).&amp;nbsp;&lt;br /&gt;Instead of our Unleashed: one dual role with preferred connection parameters: 8(10ms)-12(15ms), 2mbps PHY and MTU/Datalength: 247/251&lt;br /&gt;Instead of our App: nRF Connect on an iPhone.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I already tested using nRF connect with our devices and I see the same error, so it has nothing to do with our app.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343696?ContentTypeID=1</link><pubDate>Wed, 15 Dec 2021 14:35:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eea0b58-eb91-40a1-b53a-acaa59da466d</guid><dc:creator>thefool</dc:creator><description>&lt;p&gt;We&amp;#39;re using a Module with a built-in XTAL. It&amp;#39;s a crystal with max 40 ppm, but I don&amp;#39;t know the part number or load caps.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;sdk_config.h:&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;NRF_SDH_CLOCK_LF_SRC &lt;/span&gt;&lt;span&gt;1 //XTAL&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;NRF_SDH_CLOCK_LF_ACCURACY 5 //50ppm&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;We&amp;#39;re using SDK 17.0 and SD&amp;nbsp;s132_nrf52_7.0.1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343473?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 15:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a8058c6-04e7-4446-86a7-25cb28b0952f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I agree it is interesting that this seems worse with longer connection interval, and also that you only see issues in the link between A and B when B is connected to C and not D. There is still not much concrete to go on, but there are a few things worth checking out.&lt;/p&gt;
&lt;p&gt;From this log everything looks good until you get a disconnect due to timeout (0x08) on the peripheral in this link (device B). The events you log here show nothing else that seems relevant. This makes me wonder - what is the 32.768 clock source? Is it RC or crystal? And how have you configured it in SW (including accuracy in PPM)? If you use crystal, can you share your exact crystal part number and which load cap values you use? This may be a long shot, as if there was an issue here I would have expected the communication between B and C or B and D to show issues as well, but that does not seem to be the case (if it is from the same time period).&lt;/p&gt;
&lt;p&gt;Which SDK version and SoftDevice version do you use?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343460?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 15:37:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7b70527-4e8b-4fad-a8c6-473b36b85035</guid><dc:creator>thefool</dc:creator><description>&lt;p&gt;Just to clarify: This is our setup:&lt;/p&gt;
&lt;p&gt;A:iOS App (central) -&amp;gt; B:Unleashed (dual role) -&amp;gt; C:Holux (peripheral)&lt;br /&gt;&lt;span&gt;or&lt;br /&gt;&lt;/span&gt;&lt;span&gt;A:iOS App (central) -&amp;gt; B:Unleashed (dual role) -&amp;gt; D:QStarz&amp;nbsp;(peripheral)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The problem is only with the connection between A and B&amp;#39;s peripheral role!&lt;/p&gt;
&lt;p&gt;But the odd thing is that it is only problematic&amp;nbsp;when B&amp;#39;s central role is connected to C and B is scanning. &lt;br /&gt;There is no problem when B is connected to D, and it is scanning, &lt;br /&gt;nor is there a problem when B is not connected to C or D, and is scanning or not&lt;br /&gt;nor if it is connected to either C or D, but not scanning.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The only difference between C and D is the unusually long connection interval of C!&lt;br /&gt;&lt;br /&gt;We have full control over A and B, including debug output, but not over C or D. But I don&amp;#39;t think there is anything to debug here - as the B-&amp;gt;C or B-&amp;gt;D connections work flawlessly - but C&amp;nbsp;has a weird influence on the connection A-&amp;gt;B.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s Debug output of the Events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_stack.c : 525: 38734: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 38735: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 38946: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 38947: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39006: BLE event: 57&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39798: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39799: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39894: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39894: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39901: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 154: 39952: Requesting to update ATT MTU to 247 bytes on connection 0x3&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 77: 39952: Updating data length to 251 on connection 0x3.&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_conn_params.c : 163: 39952: Connection interval (handle 3) not acceptable actual max 30, preferred min 10 max 15&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 282: 39952: Connection parameters rejected - will retry negotiation&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 39952: BLE event: 16&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 426: 39952: PERIPHERAL: Connected&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 427: 39952: Connection interval: 30 ms&lt;/code&gt;&lt;br /&gt;&lt;code&gt;accessories_core.c : 174: 39952: Scanning started&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;unleashed_ble.c : 102: 39952: App connected&lt;/code&gt;&lt;br /&gt;&lt;code&gt;app_state.c : 195: 39955: App state changed to BACKGROUND&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;ble_srv_utils.c : 225: 39959: Updating system attributes [0x00]&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 307: 40029: Data length updated to 251 on connection 0x3&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 311: 40029: Max RX octets: 251&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 313: 40029: Max TX octets: 251&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 315: 40029: Max RX time: 2120&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 317: 40029: Max TX time: 2120&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 40029: BLE event: 36&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 40082: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 40083: BLE event: 29&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nrf_ble_gatt.c : 214: 40155: ATT MTU updated to 185 bytes on connection 0x3 (response).&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 165: 40155: GATT ATT MTU changed to 185&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 40155: BLE event: 58&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 525: 40250: BLE event: 17&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 437: 40250: PERIPHERAL: Disconnected&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ble_stack.c : 452: 40250: - UNKNOWN REASON [0x08]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;From the Sniffing session, we can see that B&amp;#39;s peripheral role stops responding in the middle of service discovery (initiated by A). The responses to Service discovery&amp;nbsp;is handled entirely by the soft device, is it not? Can we get any debug output of an &amp;quot;internal state&amp;quot; during service discovery? There are many steps involved, so I&amp;#39;m sure you&amp;#39;re going through a state machine...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I can try edit the scanning parameters, but since they work perfectly when connected to D, I can&amp;#39;t see how that would help.&lt;br /&gt;&lt;br /&gt;I would understand problems with dropped packets if the connection interval to C would be the shortest possible, and we&amp;#39;re be maximising data transfer there, and would be scanning at the same time. Then I get that the radio would be at capacity. But the odd thing is that the really long interval seems to have the negative effect, whereas it works perfectly with a shorter interval...&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/343137?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 11:53:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3926d8d-7a78-4849-b792-7cb1561a753f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="thefool"]Our device is not showing any signs of getting stuck, so we&amp;#39;re assuming it&amp;#39;s the soft device.[/quote]
&lt;p&gt;I am confused about this. By &amp;quot;our device&amp;quot;, so you mean the central (in the&amp;nbsp;unleasshed-holux-app-connect-scan-disconnect-app-reconnect-fail.pcapng)? And by &amp;quot;soft device&amp;quot; do you mean the peripheral as a whole, or do you mean the SoftDevice as in the BLE stack we provide?&lt;/p&gt;
[quote user="thefool"]Can&amp;nbsp;we poll the softdevice&amp;nbsp;state for debugging? Any specific info we should try to get?[/quote]
&lt;p&gt;The SoftDevice generates events for most scenarios, and also use asserts for most unthinkable scenarios so it is very rare that it files silently. This is the default behavior and there is no special &amp;quot;debug mode&amp;quot;. I suggest you enable logging on the peripheral to see what happens there. Generally in the vast majority of cases the issue is in the application code and not in the SoftDevice. The first step needs to be to debug the behavior on the peripheral side (which for some reason has stopped to acknowledge packets).&lt;/p&gt;
[quote user="thefool"]&lt;p&gt;The odd thing is that this only happens if our device is simultaneously connected as central with a 650ms connection interval and is scanning as central while we&amp;#39;re trying to connect to its peripheral instance.&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s connected as central with a 75ms connection interval, and is scanning, then there&amp;#39;s no problem!&amp;nbsp;&lt;/p&gt;[/quote]
&lt;p&gt;Is it just in this specific connection interval (650 ms) it fails, or is there a more general tendency here? Generally, the SoftDevice will drop some packets now and then when there are collisions. That is controlled by the &lt;a href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/multilink_scheduling/priorities_and_events_intro.html"&gt;SoftDevice scheduling priorities&lt;/a&gt;&amp;nbsp;and so the connection should not timeout. Can you try to reduce the scan window size and and perhaps also the frequency and see if that helps? Normally that should not be needed though, so I am not very optimistic this would.&lt;/p&gt;
&lt;p&gt;Did you make the peripheral here, so that you can debug it? As mentioned, that seems like the obvious way forward. If that is not possible (so that the peripheral - where the failure seems to be - is a black box), then the approach would have to be mostly trial and error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/342966?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 15:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15e9e851-fced-4343-9caf-8175e8e4ae4c</guid><dc:creator>thefool</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;yes, exactly. That&amp;#39;s what we were observing too. Our device is not showing any signs of getting stuck, so we&amp;#39;re assuming it&amp;#39;s the soft device. After all it stops responding in the middle of service discovery.&amp;nbsp;Can&amp;nbsp;we poll the softdevice&amp;nbsp;state for debugging? Any specific info we should try to get?&lt;br /&gt;&lt;br /&gt;The odd thing is that this only happens if our device is simultaneously connected as central with a 650ms connection interval and is scanning as central while we&amp;#39;re trying to connect to its peripheral instance.&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s connected as central with a 75ms connection interval, and is scanning, then there&amp;#39;s no problem!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 dual role: while connected as central and scanning, connection as peripheral fails</title><link>https://devzone.nordicsemi.com/thread/342959?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 14:37:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74c97b1d-98fa-4344-9c9a-7e203525d627</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Looking at&amp;nbsp;unleasshed-holux-app-connect-scan-disconnect-app-reconnect-fail.pcapng I see the intended disconnect in #3228, and then a re-connection, data exchange, and a new sudden disconnect at #3486. Looking at the packets before there you see that there is a lot of retransmissions, so the disconnect here with reason 8 (timeout) is expected given that. There is no telling why there are all these retransmissions, though. Are you able to debug both devices? It seems clear that the peripheral stopped receiving and acknowledging the packets. Perhaps it is in a bad state? The sniffer trace does not give information about this, though I suggest you debug on the peripheral side to see what state it is in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>