<?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>&amp;quot;Failed enabling advertiser&amp;quot; when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340</link><description>I&amp;#39;ve tried to run a program which allows to run mesh provisioner, among with Direction Finding connectionless locator. 
 I was using mesh provisioner example from Zephyr, and previously tested it on nRF52840 - it seemed to be working fine. However when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Mar 2022 09:33:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340" /><item><title>RE: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/355468?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2022 09:33:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c03cda85-a3b4-4c96-9819-2527806b158e</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Sorry about the late reply, but I was out of office on Friday, and had some catching up to do.&lt;/p&gt;
&lt;p&gt;No, extended advertising is not part of the Mesh stack. This is by specification. See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/83424/support-of-extended-advertising-within-ble-mesh-stack-in-nrf-connectsdk"&gt;this case by my colleague Terje&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t find any mention of a config called&amp;nbsp;CONFIG_BT_MESH_EXT_ADV.&amp;nbsp; I think you need to enable/disable extended advertising (with&amp;nbsp;&lt;span&gt;CONFIG_BT_EXT_ADV)&amp;nbsp;&lt;/span&gt;whenever you switch between Mesh and Direction Finding.&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: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/355193?ContentTypeID=1</link><pubDate>Mon, 28 Feb 2022 09:08:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3b93cb6-7c8e-4308-92e4-6d9394159cc2</guid><dc:creator>unkn0wnerr0r</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Any updates?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/355013?ContentTypeID=1</link><pubDate>Fri, 25 Feb 2022 12:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faf7bec8-350f-4685-9f25-048a2856618e</guid><dc:creator>unkn0wnerr0r</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;After some experiments, I think I know the reason.&lt;/p&gt;
&lt;p&gt;Since Direction Finding relies on Extended Advertising, configuring this in prj.conf would automatically switch on CONFIG_BT_MESH_EXT_ADV. And from what I see, mesh samples both in NRF Connect SDK and in Zephyr are on Legacy Advertising.&lt;/p&gt;
&lt;p&gt;Is there a support for Bluetooth Mesh extended advertising for nRF5340?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/354750?ContentTypeID=1</link><pubDate>Thu, 24 Feb 2022 09:48:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:346d1cf4-2c8f-4127-8270-f16054e91bce</guid><dc:creator>unkn0wnerr0r</dc:creator><description>[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354740#354740"]How do you initialize the Mesh stack before calling this &amp;quot;bt_mesh_main&amp;quot; function, and how does your bt_mesh_main function look?[/quote]
&lt;p&gt;&amp;quot;bt_mesh_main&amp;quot; isn&amp;#39;t a function, it&amp;#39;s a log module of zephyr/subsys/bluetooth/mesh/main.c. The function calling this is bt_mesh_start:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int bt_mesh_start(void)
{
	int err;

	err = bt_mesh_adv_enable();
	if (err) {
		BT_ERR(&amp;quot;Failed enabling advertiser&amp;quot;);
		return err;
	}

	if (bt_mesh_beacon_enabled()) {
		bt_mesh_beacon_enable();
	} else {
		bt_mesh_beacon_disable();
	}

	if (!IS_ENABLED(CONFIG_BT_MESH_PROV) || !bt_mesh_prov_active() ||
	    bt_mesh_prov_link.bearer-&amp;gt;type == BT_MESH_PROV_ADV) {
		if (IS_ENABLED(CONFIG_BT_MESH_PB_GATT)) {
			(void)bt_mesh_pb_gatt_disable();
		}

		if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
			(void)bt_mesh_proxy_gatt_enable();
			bt_mesh_adv_gatt_update();
		}
	}

	if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
		bt_mesh_lpn_init();
	} else {
		bt_mesh_scan_enable();
	}

	if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
		bt_mesh_friend_init();
	}

	if (IS_ENABLED(CONFIG_BT_MESH_PROV)) {
		struct bt_mesh_subnet *sub = bt_mesh_subnet_next(NULL);
		uint16_t addr = bt_mesh_primary_addr();

		bt_mesh_prov_complete(sub-&amp;gt;net_idx, addr);
	}

	bt_mesh_hb_start();

	bt_mesh_model_foreach(model_start, NULL);

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is triggered when calling bt_mesh_adv_enable(). So when &lt;strong&gt;bt_ready_prov&lt;/strong&gt; function is called, it calls &lt;strong&gt;bt_mesh_provision,&amp;nbsp;&lt;/strong&gt;the the stack follows like this: bt_mesh_adv_enable() (in adv_ext.c) -&amp;gt;&amp;nbsp;bt_le_ext_adv_create() -&amp;gt;&amp;nbsp;le_ext_adv_param_set (in adv.c) -&amp;gt;&amp;nbsp;bt_hci_cmd_send_sync() -&amp;gt;&amp;nbsp;bt_hci_cmd_send_sync (in hci_core.c)&lt;/p&gt;
&lt;p&gt;As for mesh stack inilialisation, here are the prov and comp objects passed to bt_ready_prov:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* This application only needs one element to contain its models */
struct bt_mesh_model models[] = {
	BT_MESH_MODEL_CFG_SRV,
        BT_MESH_MODEL_CFG_CLI(&amp;amp;cfg_cli),
        BT_MESH_MODEL_HEALTH_CLI(&amp;amp;health_cli_prov),
	BT_MESH_MODEL_HEALTH_SRV(&amp;amp;health_srv, &amp;amp;health_pub),
	BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_ONOFF_SRV, gen_onoff_srv_op, &amp;amp;gen_onoff_srv_pub,
		      NULL),
	BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_ONOFF_CLI, gen_onoff_cli_op, &amp;amp;gen_onoff_cli_pub,
		      NULL),
        BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_LEVEL_SRV, gen_level_srv_op, &amp;amp;gen_level_srv_pub,
		      NULL),
        BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_LEVEL_CLI, gen_level_cli_op, &amp;amp;gen_level_cli_pub,
		      NULL),
        BT_MESH_MODEL_VND(ATAMATE_CID, VND_CLI_MODEL_ID, vnd_cli_ops, &amp;amp;gen_level_vnd_pub, &amp;amp;vnd_user_data),
};

struct bt_mesh_elem elements[] = {
	BT_MESH_ELEM(0, models, BT_MESH_MODEL_NONE),
};

const struct bt_mesh_comp comp = {
	.cid = BT_COMP_ID_LF,
	.elem = elements,
	.elem_count = ARRAY_SIZE(elements),
};


static void unprovisioned_beacon(uint8_t uuid[16],
				 bt_mesh_prov_oob_info_t oob_info,
				 uint32_t *uri_hash)
{
	memcpy(node_uuid, uuid, 16);
	k_sem_give(&amp;amp;sem_unprov_beacon);
}

static void node_added(uint16_t net_idx, uint8_t uuid[16], uint16_t addr, uint8_t num_elem)
{
	node_addr = addr;
	k_sem_give(&amp;amp;sem_node_added);
}


const struct bt_mesh_prov provisioner = {
	.uuid = dev_uuid,
        .unprovisioned_beacon = unprovisioned_beacon,
        .node_added = node_added,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Except for the bigger number of mesh models and its implementation (which I did based on samples and walkthroughs), the rest is based on Zephyr samples.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354740#354740"]4. Yes, -5 is an I/O error, what exact function returns this. If you don&amp;#39;t have an antenna array connected to the nRF53 device (which is required on the RX side in an AoA application).[/quote]
&lt;p&gt;It&amp;#39;s actually called not because of Direction Finding, but because of mesh initialisation. The function I mentioned above, bt_mesh_adv_enable(), returns that error. Which, in fact, gets that error from.&lt;/p&gt;
&lt;p&gt;P.S:&amp;nbsp;about antenna array - you mean configuring it like it&amp;#39;s described here &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_connectionless_rx/README.html"&gt;developer.nordicsemi.com/.../README.html&lt;/a&gt;&amp;nbsp;? I&amp;#39;ve done that&lt;/p&gt;
&lt;p&gt;P.P.S: is it possible that some configuration options might prevent from working correctly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/354740?ContentTypeID=1</link><pubDate>Thu, 24 Feb 2022 09:05:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdd11478-741f-4f3c-a282-8317451d5fc8</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1 &amp;amp; 2. Okay, then it doesn&amp;#39;t seem to be a conflict between Direction Finding and Mesh, but rather something in the Mesh side of the application not working as intended. How do you initialize the Mesh stack before calling this &amp;quot;bt_mesh_main&amp;quot; function, and how does your bt_mesh_main function look?&lt;/p&gt;
&lt;p&gt;3. I see, it will be hard to debug this without knowing what exact function returns this.&lt;/p&gt;
&lt;p&gt;4. Yes, -5 is an I/O error, what exact function returns this. If you don&amp;#39;t have an antenna array connected to the nRF53 device (which is required on the RX side in an AoA application).&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: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/354626?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 14:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36b61820-b303-487e-80c2-912ac4e9a4d0</guid><dc:creator>unkn0wnerr0r</dc:creator><description>[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354614#354614"]I have a few questions here. First off, the nRF52840 doesn&amp;#39;t support the Direction Finding (introduced in BLE 5.1) so it seems strange that the locator application would work with that board at all.&amp;nbsp;[/quote]
&lt;p&gt;It doesn&amp;#39;t. But I&amp;#39;ve had in CMakeLists.txt and in the code itself safety measures, such as &amp;quot;if the chosen board isn&amp;#39;t nRF5340, then all direction finding code won&amp;#39;t be included in the project&amp;quot;. That had no issues. So basically when I ran this code in nRF52840, anything related to direction finding isn&amp;#39;t there and it runs only provisioner.&amp;nbsp;&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354614#354614"]is this advertising happening in over Bluetooth Mesh?[/quote]
&lt;p&gt;I guess so, because the code was supposed to launch mesh provisioner.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354614#354614"]The error from your log does not seem to be related to advertising but rather an error from a log line with &amp;quot;direction_rx&amp;quot; (which I can&amp;#39;t find in the nRF Connect SDK). Have you added this logging line yourself?[/quote]
&lt;p&gt;&amp;quot;direction_rx&amp;quot; is basically the sample code from direction_finding_connectionless_rx from the Nordic samples. Only thing I changed was to rename &amp;quot;main&amp;quot; to a different function so I could run it as a thread.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354614#354614"]Are you able to see what the err -5 returns as? What NCS version are you working on?[/quote]
&lt;p&gt;-5 is EIO, which is weird for me. NCS is the latest one, 1.9.0.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/85041/failed-enabling-advertiser-when-running-mesh-provisioner-on-nrf5340/354614#354614"]Lastly, Bluetooth Mesh and Direction Finding features are not trivial to combine I&amp;#39;m afraid, since they both use timeslots they will likely have quite a few conflicts on time critical tasks, so you need to use something like the&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/mpsl/timeslot/README.html"&gt; MPSL timeslot functionality&lt;/a&gt; to handle correctly.[/quote]
&lt;p&gt;Duly noted, I&amp;#39;ll look at this, thanks!&lt;/p&gt;
&lt;p&gt;P.S: even if I comment the thread initialisation for Direction Finding so it could run only provisioner, it still throws &amp;quot;&lt;span&gt;Failed enabling advertiser&amp;quot;. Could there be something around configuration files? I have a regular &amp;quot;prj.conf&amp;quot;, and &amp;quot;hci_rpmg.conf&amp;quot; in &amp;quot;child_image&amp;quot; folder which is copied from Direction Finding sample. Also, if I run a sample of mesh_provisioner from Zephyr samples, during the provision of another remote device&amp;nbsp;it reboots throwing stack overflow error and hard reset.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Failed enabling advertiser" when running mesh provisioner on nRF5340</title><link>https://devzone.nordicsemi.com/thread/354614?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 14:07:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b416240f-f1db-4a37-b1c7-58e7346235d5</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have a few questions here. First off, the nRF52840 doesn&amp;#39;t support the Direction Finding (introduced in BLE 5.1) so it seems strange that the locator application would work with that board at all.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Secondly, you say that the error you see is &amp;quot;Failed enabling advertiser&amp;quot; but the Direction Finding locator doesn&amp;#39;t advertise, is this advertising happening in over Bluetooth Mesh? The error from your log does not seem to be related to advertising but rather an error from a log line with &amp;quot;direction_rx&amp;quot; (which I can&amp;#39;t find in the nRF Connect SDK). Have you added this logging line yourself? Are you able to see what the err -5 returns as? What NCS version are you working on?&lt;/p&gt;
&lt;p&gt;Lastly, Bluetooth Mesh and Direction Finding features are not trivial to combine I&amp;#39;m afraid, since they both use timeslots they will likely have quite a few conflicts on time critical tasks, so you need to use something like the&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/mpsl/timeslot/README.html"&gt; MPSL timeslot functionality&lt;/a&gt; to handle correctly.&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>