<?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>Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115871/dynamically-configurable-central-peripheral-role</link><description>nRF52832 &amp;amp; NCS v2.6.1 
 I merged the NUS central and NUS peripheral FW into a single one where the user calls appropriate initialization functions to activate whether central or peripheral role. 
 For this to work, I had to include both CONFIG_BT_CENTRAL</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 31 Oct 2024 07:49:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115871/dynamically-configurable-central-peripheral-role" /><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508609?ContentTypeID=1</link><pubDate>Thu, 31 Oct 2024 07:49:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1a91454-1146-4440-b558-7228cc96d8a0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, it is safe to ignore the warning. It&amp;#39;s also possible to avoid the warning by using the&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;a title="https://github.com/nrfconnect/sdk-zephyr/blob/main/include/zephyr/bluetooth/bluetooth.h#l547" href="https://github.com/nrfconnect/sdk-zephyr/blob/main/include/zephyr/bluetooth/bluetooth.h#L547" rel="noopener noreferrer" target="_blank"&gt;BT_LE_ADV_OPT_ONE_TIME&lt;/a&gt;&amp;nbsp;option flag in your adv. paramaters and let your application call advertising start after disconnect events.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508561?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2024 15:29:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13d7a600-932b-4e19-8ba5-92b804cc1fd8</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;Thank you for your feedback. In the meantime, is it safe to just ignore this warning?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508491?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2024 10:24:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:401683ce-ebbb-4c91-907b-3245956e4493</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for confirming. I was able to reproduce this issue with SDK v2.7.0. It turns out that the host attempts to restart advertising upon connection to allow for another peripheral connection when BT_MAX_CONN &amp;gt; 1. However, this should not&amp;nbsp;happen&amp;nbsp;when CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT == 1. I will report this internally.&lt;/p&gt;
&lt;p&gt;Update:&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;The advertisement resume feature has been deprecated in upstream zephyr:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/commit/8cfad44852845cd30336d40f61dade69ab4357db#diff-8cadc78f71e77935aca30e96bc8baebc6f8a7b87c5c3c79f6f899cf92e9da2e8"&gt;https://github.com/zephyrproject-rtos/zephyr/commit/8cfad44852845cd30336d40f61dade69ab4357db#diff-8cadc78f71e77935aca30e96bc8baebc6f8a7b87c5c3c79f6f899cf92e9da2e8&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508465?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2024 08:52:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a06584a1-fe4c-4e4a-b7bb-c8a29b55975e</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;No, I only call bt_le_adv_start() once in the initialization function that puts the device into peripheral role.&lt;/p&gt;
&lt;p&gt;I temporarily added a log output to bt_le_adv_start() to see whenever it gets called. And it indeed only gets called once at start as described above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508300?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 08:42:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9b59c18-a6a4-460b-96d1-ac8d9c1434c3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The warning indicates that the advertiser failed to start, which isn&amp;#39;t a problem if you are already connected to the central. But it is not clear why the advertiser is being started when you establish the connection. Is&amp;nbsp;bt_le_adv_start() being called in multiple places in your version?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508239?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 18:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2750b877-81af-4ec6-975f-bb88b7f2d934</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;When I increase CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT from default 1 to 2, the build fails:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;In file included from C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain.h:50,
                 from C:/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:23,
                 from C:/ncs/v2.6.1/zephyr/include/zephyr/kernel.h:17,
                 from C:/ncs/v2.6.1/nrf/subsys/bluetooth/controller/hci_driver.c:7:
C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: &amp;quot;&amp;quot;
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, &amp;quot;&amp;quot; MSG)
      |                                    ^~~~~~~~~~~~~~
C:/ncs/v2.6.1/nrf/subsys/bluetooth/controller/hci_driver.c:55:1: note: in expansion of macro &amp;#39;BUILD_ASSERT&amp;#39;
   55 | BUILD_ASSERT(!IS_ENABLED(CONFIG_BT_CENTRAL) ||
      | ^~~~~~~~~~~~
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I also increased CONFIG_BT_MAX_CONN from default 2 to 3 and was able to build. But I still get the same warning.&lt;/p&gt;
&lt;p&gt;Please note that the peripheral-central connection works despite this message, so I don&amp;#39;t really understand what this message is telling. Is it a simple indication that the limit has been reached? If so, why didn&amp;#39;t I get it on a peripheral-only project where the limit was 1 connection as well?&lt;/p&gt;
&lt;p&gt;Also, the CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT description says:&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#f3f3f3;color:#616161;float:none;font-family:&amp;#39;Segoe WPC&amp;#39;, &amp;#39;Segoe UI&amp;#39;, sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;Number of concurrent peripheral roles defines how many simultaneous connections can be created with the device working as a peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So I believe this should be left to 1 since I only want a single connection from a peripheral device to the central.&lt;span style="background-color:#f3f3f3;color:#616161;float:none;font-family:&amp;#39;Segoe WPC&amp;#39;, &amp;#39;Segoe UI&amp;#39;, sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically configurable central/peripheral role</title><link>https://devzone.nordicsemi.com/thread/508129?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 11:56:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8985e53e-6447-4576-bc73-8bcec0de871e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The opcode is&amp;nbsp;SDC_HCI_OPCODE_CMD_LE_SET_ADV_ENABLE to start the advertiser and the status indicates&amp;nbsp;CONNECTION REJECTED DUE TO LIMITED&lt;br /&gt;RESOURCES (0x0D). This suggests that you have already reached the max. number of peripheral connections supported by the controller.&lt;/p&gt;
&lt;p&gt;The number of peripheral connections that can be supported are automatically reduced when BT_CENTRAL is enabled:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/d3a8699e25991a8f624603da278272728c913657/subsys/bluetooth/Kconfig#L23"&gt;https://github.com/nrfconnect/sdk-nrf/blob/d3a8699e25991a8f624603da278272728c913657/subsys/bluetooth/Kconfig#L23&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can try to incrase the CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT value in your project configuration file to see if the problem persits.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>