<?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>Zephyr - Device does not advertise if advertisement data is set</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76312/zephyr---device-does-not-advertise-if-advertisement-data-is-set</link><description>Hello! 
 
 I am trying to create a connectable advertiser that can have its advertisement data updated dynamically on a nrf52832. I am creating the advertisement with this code: 
 
 
 If I then start advertising with 
 
 It starts advertising and I can</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Jun 2021 13:14:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76312/zephyr---device-does-not-advertise-if-advertisement-data-is-set" /><item><title>RE: Zephyr - Device does not advertise if advertisement data is set</title><link>https://devzone.nordicsemi.com/thread/315410?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 13:14:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3037911-7262-436e-b7c4-b168fabb2dc8</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;ve not worked too much with this, so if you would you be able to upload your whole application in zipped format, that would be nice. Then I&amp;#39;ll test it out/ask internally and see if I can get it to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr - Device does not advertise if advertisement data is set</title><link>https://devzone.nordicsemi.com/thread/315248?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 22:46:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:903b4e5e-ad12-4ead-9ffa-d1aeba565823</guid><dc:creator>smackenzie</dc:creator><description>&lt;p&gt;This code does not work. I can not see any advertisements in the nrfconnect application. However there is no error anywhere being reported.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;constexpr bt_le_adv_param  params =  BT_LE_ADV_PARAM_INIT(
	BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_USE_IDENTITY | BT_LE_ADV_OPT_CONNECTABLE,
	BT_GAP_ADV_FAST_INT_MIN_2,
	BT_GAP_ADV_FAST_INT_MAX_2,
	NULL
);
	

int err = bt_le_ext_adv_create(&amp;amp;params, &amp;amp;cbs, &amp;amp;adv);
__ASSERT(err == 0, &amp;quot;Create advertiser init&amp;quot;);

AdvData data {
	AdvField&amp;lt;uint8_t&amp;gt;  { BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR) },
	AdvField&amp;lt;uint16_t&amp;gt; { BT_DATA_MANUFACTURER_DATA, 0x1234 }
};
err = bt_le_ext_adv_set_data(adv, data.data(), data.size(), 0, 0);
__ASSERT(err == 0, &amp;quot;advertiser_set_data&amp;quot;);
	

bt_le_ext_adv_start_param start_params = {
	.timeout = 0,
	.num_events = 0
};
err = bt_le_ext_adv_start(adv, &amp;amp;start_params);
__ASSERT(err == 0, &amp;quot;advertiser_start_advertising&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I either remove the `bt_le_ext_adv_set_data` or remove&amp;nbsp;the `BT_LE_ADV_OPT_CONNECTABLE` flag, the code starts working and I can see the advertisements in the nrfconnect application.&lt;/p&gt;
&lt;p&gt;Its the combination of both setting the data and being connectable that is causing an issue.&lt;/p&gt;
&lt;p&gt;Is there some requirement&amp;nbsp;I am missing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr - Device does not advertise if advertisement data is set</title><link>https://devzone.nordicsemi.com/thread/315211?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 15:40:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34dd850f-535e-4a76-a11f-30ec45f5d5dd</guid><dc:creator>Simon</dc:creator><description>[quote user=""]How do&amp;nbsp;I correctly set the advertisement data before starting advertising using the `bt_le_ext` methods?[/quote]
&lt;p&gt;Take a look at the sample &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/nrf/samples/bluetooth/peripheral_hr_coded/README.html"&gt;/ncs/nrf/samples/bluetooth/peripheral_hr_coded/src/main.c&lt;/a&gt;, which does this. This sample does not support the nRF52832, but it should give you an idea how to go about it.&lt;/p&gt;
&lt;p&gt;First it sets the ext adv data:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L166"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L166&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L91"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L91&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then it starts the advertising&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L127"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L127&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L100"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.5.1/samples/bluetooth/peripheral_hr_coded/src/main.c#L100&lt;/a&gt;&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>