<?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>How to change advertising interval run time with SDK 15.2.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46715/how-to-change-advertising-interval-run-time-with-sdk-15-2-0</link><description>Hi, I am using nrf52832 with SDK 15.2.0 and nrf 52 dev board. I want change advertising interval in run time so I call a function with the interval as the parameter change_adv_interval (interval ) every time that I will change. 
 Thanks in Advance.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Jun 2020 11:10:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46715/how-to-change-advertising-interval-run-time-with-sdk-15-2-0" /><item><title>RE: How to change advertising interval run time with SDK 15.2.0</title><link>https://devzone.nordicsemi.com/thread/252686?ContentTypeID=1</link><pubDate>Tue, 02 Jun 2020 11:10:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:091a266d-b901-4bba-9f8a-6f842c096eee</guid><dc:creator>DinoDino</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;I am using SDK16 and NRF52 DK. My goal is to update advertising interval in non-connectable mode dynamically. I don&amp;#39;t use advertising module and I am following code from pwr_profiling&amp;nbsp;example to setup advertisement parameters.&lt;/p&gt;
&lt;p&gt;In order to update the advertising interval, I wrote a function which stops advertising and then updates the interval and calls the function &lt;strong&gt;sd_ble_gap_adv_set_configure&lt;/strong&gt;. I have thought of another approach too and it&amp;#39;s commented down there.&lt;/p&gt;
&lt;p&gt;However, the function &lt;strong&gt;sd_ble_gap_adv_stop&lt;/strong&gt; fails without any return code. I tried to set a breakpoint and debug, but in vain. Let me know if it is necessary to stop advertisement for this use-case in SDK16 and how to update update advertising interval dynamically. And as well as a technique to debug and find error code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void non_conn_adv_interval_update(int8_t m_adv_interval)
{
      ret_code_t      err_code;
      err_code = sd_ble_gap_adv_stop(m_adv_handle);
      APP_ERROR_CHECK(err_code);

      // Approach 1 : 
      NRF_LOG_INFO(&amp;quot;Adv interval : %d&amp;quot;, m_adv_interval);
      m_adv_params.interval        = m_adv_interval;
      err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;m_adv_params);
      APP_ERROR_CHECK(err_code);

      // Approach 2:
      //non_connectable_adv_init(m_adv_interval);
      //advertising_start(true);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Dino&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change advertising interval run time with SDK 15.2.0</title><link>https://devzone.nordicsemi.com/thread/191139?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2019 13:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8110b55d-3a10-4e5e-8a87-701c9cc69d9f</guid><dc:creator>pd@learner</dc:creator><description>&lt;p&gt;Thanks It Works&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change advertising interval run time with SDK 15.2.0</title><link>https://devzone.nordicsemi.com/thread/184253?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2019 09:24:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a68797c8-8abb-4e05-8ab5-d4e0b8feec36</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Prashant&lt;/p&gt;
&lt;p&gt;You need to stop and start the advertising when you do your updates. It should be possible with something similar to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sd_ble_gap_adv_stop();

ble_gap_adv_params_t adv_params;
memset(&amp;amp;adv_params, 0, sizeof(adv_params));
adv_params.interval = interval;
adv_params.timeout = 0;

err_code = sd_ble_gap_adv_start(&amp;amp;adv_params);
APP_ERROR_CHECK(err_code);&lt;/pre&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>