<?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>ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48600/ble_app_template-based-app-with-adv-frame-update-during-runntime</link><description>(SES + SDK15) Hi! I am trying to create an new firmware prototype based on ble_app_template_sample Until now I have a connectable firmware, with one service and several characteristics. Everything is working well. But now I have the need to change the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jun 2019 10:33:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48600/ble_app_template-based-app-with-adv-frame-update-during-runntime" /><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/193132?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 10:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d1e6f72-7a43-4747-bd75-bee0262a9776</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;That&amp;#39;s good to gear - please verify the answer:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3733._5F00_Verify_2D00_answer_2D00_nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192933?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 12:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43149c46-2b0d-4fe3-952c-2d3eea167ade</guid><dc:creator>Alex Co</dc:creator><description>&lt;p&gt;Thanks for the code. After testing it, it finally works !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192930?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 12:51:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74d7eba4-9d4a-4460-846e-3790abb0510e</guid><dc:creator>Alex Co</dc:creator><description>&lt;p&gt;imagine second by second. I have already implemented the restart approach and central can not connect to it... If I increase frequency of updates, say 10 s then central connects well&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192923?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 12:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19377fb4-5a7c-40f2-b986-7131480011d3</guid><dc:creator>awneil</dc:creator><description>[quote userid="73166" url="~/f/nordic-q-a/48600/ble_app_template-based-app-with-adv-frame-update-during-runntime/192913"]The documentation on sd_ble_gap_adv_set_configure() states that &amp;quot;In order to update advertising data while advertising, new advertising buffers must be provided&amp;quot;. [/quote]
&lt;p&gt;But gives you no clue to how to actually &lt;em&gt;&lt;strong&gt;do&lt;/strong&gt;&lt;/em&gt; that!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192913?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 11:48:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae04705c-5beb-41cb-8d9b-e1c30aa5168c</guid><dc:creator>Hakon</dc:creator><description>[quote user="awneil"]That was because the SDK claims to support on-the-fly updates, but it actually doesn&amp;#39;t seem to work.[/quote]
&lt;p&gt;The SDK is correct in this case. The documentation on sd_ble_gap_adv_set_configure() states that &amp;quot;In order to update advertising data while advertising, new advertising buffers must be provided&amp;quot;. So that means in order to update the advertising data you need to pass a different buffer from the previous one. Just use two buffers and switch between them works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192905?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 11:28:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49f0e18f-33c5-4288-89b6-fba75b8aea70</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hey, the advertising data can be changed during advertising, but you need to use two buffers and switch between them. Refer to the code below to see how it can be implemented.&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_data_update2(uint8_t adv_manuf_byte)
{
   ble_advdata_t              advdata;       /**&amp;lt; Advertising data: name, appearance, discovery flags, and more. */
   
	ble_advdata_manuf_data_t 	adv_manuf_data;
	
    uint8_array_t            	adv_manuf_data_array;
    uint32_t ret = NRF_SUCCESS;
    static uint8_t buffer1[28];
	static uint8_t buffer2[28];
	
	uint8_t * buffer;
	
	static bool b = true;
	
	buffer = b ? buffer1 : buffer2;
	
	adv_manuf_data_data[0]     = adv_manuf_byte;
		adv_manuf_data_data[2]     = adv_manuf_byte;

    memset(&amp;amp;advdata, 0, sizeof(advdata));
   
    advdata.name_type          	        = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance 	        = false;
    advdata.flags              	        = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;


	adv_manuf_data_array.p_data         = adv_manuf_data_data;
	adv_manuf_data_array.size 			= sizeof(adv_manuf_data_data);
	adv_manuf_data.company_identifier   = 0x0059;
	adv_manuf_data.data 				= adv_manuf_data_array;
	advdata.p_manuf_specific_data 		= &amp;amp;adv_manuf_data;
	

    memset(buffer, 0, m_advertising.adv_data.adv_data.len);
    ble_gap_adv_data_t new_advdata;
    memset(&amp;amp;new_advdata, 0, sizeof(new_advdata));
    new_advdata.adv_data.p_data = buffer;
    new_advdata.adv_data.len = m_advertising.adv_data.adv_data.len;      
    ret = ble_advdata_encode(&amp;amp;advdata, new_advdata.adv_data.p_data, &amp;amp;new_advdata.adv_data.len);
	  NRF_LOG_INFO(&amp;quot;ble_advdata_encode ret:%d&amp;quot;,ret);
    APP_ERROR_CHECK(ret);
	
	
	  ret = ble_advertising_advdata_update(&amp;amp;m_advertising,&amp;amp;new_advdata,false);
	  NRF_LOG_INFO(&amp;quot;ble_advertising_advdata_update ret:%d&amp;quot;,ret);
    APP_ERROR_CHECK(ret);

	b = !b;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192876?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 09:27:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd7bb91d-9718-45f7-ac0a-9aaf8e4cf681</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5751._5F00_Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192860?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 08:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8285365e-e0f8-464b-82d9-b9b21542ed6e</guid><dc:creator>awneil</dc:creator><description>[quote userid="20031" url="~/f/nordic-q-a/48600/ble_app_template-based-app-with-adv-frame-update-during-runntime/192851"]I just can see (re)start advertising and not changing advertising without restarting[/quote]
&lt;p&gt;Yes, that&amp;#39;s true.&lt;/p&gt;
&lt;p&gt;That was because the SDK claims to support on-the-fly updates, but it actually doesn&amp;#39;t seem to work.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/45644/how-do-i-simply-do-a-non-connectable-advert-on-nrf52-using-sdk-15/187363#187363"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/45644/how-do-i-simply-do-a-non-connectable-advert-on-nrf52-using-sdk-15/187363#187363&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/41669/ble_advertising_advdata_update/183212#183212"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/41669/ble_advertising_advdata_update/183212#183212&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="20031" url="~/f/nordic-q-a/48600/ble_app_template-based-app-with-adv-frame-update-during-runntime/192851"]if i stop and start&amp;nbsp; central devices will see problems connecting to peripheral because it will be restarting from second to second[/quote]
&lt;p&gt;That &lt;em&gt;may&lt;/em&gt; not actually be a problem in practice, as advertising is not continuous anyhow - it is discrete &amp;quot;events&amp;quot; separated by the advertising interval.&lt;/p&gt;
&lt;p&gt;How frequently do you need to update the advertising data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192851?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 08:34:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4320f57-fdf4-4f56-bcfa-b63fd7c6b1e3</guid><dc:creator>Alex Co</dc:creator><description>&lt;p&gt;Sorry but I just can see (re)start advertising and not changing advertising without restarting :-(&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I can change advertising by stopping it and start it again but as the prototype is connectable,if i stop and start&amp;nbsp; central devices will see problems connecting to peripheral because it will be restarting from second to second in order to update adv data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any source code to change just one byte would be very appreaciated&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_template based app with adv frame update during runntime?</title><link>https://devzone.nordicsemi.com/thread/192848?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 08:27:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0074db3-797e-4159-b1ba-421fc3113a26</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;This thread includes updating advertising data on the fly:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47391/sdk-15-3-0-restart-non-connectable-advertising-after-timeout"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/47391/sdk-15-3-0-restart-non-connectable-advertising-after-timeout&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>