<?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>Stopping advertising</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48525/stopping-advertising</link><description>Hello, 
 i got problem wher program cant go in while loop in main while advertising is running. Im using ble uart template. So was thinking to stop advertising when button is pressed but i didnt find solution noowher how to stop advertising. In beacon</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Jan 2021 18:29:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48525/stopping-advertising" /><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/288240?ContentTypeID=1</link><pubDate>Fri, 08 Jan 2021 18:29:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:677d37c3-77a9-4355-a409-09e66ef77efb</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Was this issue every resolved and if so what exactly is the solution (i.e. a before/after comparison?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192674?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 12:11:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cafe4252-3d16-4e89-b842-9f3aa09ebdaa</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Jolly Good!&lt;/p&gt;
&lt;p&gt;Now please verify the answer.&lt;/p&gt;
&lt;p&gt;Also, for the benefit of others who may come along with a similar question, please describe how you solved it.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/6724._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: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192663?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 11:46:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e82c0e9-2412-41c6-ac96-acbb25ddbf3e</guid><dc:creator>Kev</dc:creator><description>&lt;p&gt;Solved problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192497?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 19:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9853488f-4666-4116-9b15-282544cd098d</guid><dc:creator>Kev</dc:creator><description>&lt;p&gt;yes it is. I debugget it with watch.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static volatile bool ready_to_flash_led;
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192496?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 19:10:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b614b4e-d7d5-4043-8d9a-e5cdb1c47830</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;is&amp;nbsp;ready_to_flash_led declared as volatile?&lt;/p&gt;
[quote userid="76961" url="~/f/nordic-q-a/48525/stopping-advertising/192494"]if sentence doesnt trigger writing to flash function[/quote]
&lt;p&gt;How do you know?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192495?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 19:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16aad6e9-feb6-4d24-bfd5-fd6505a7652d</guid><dc:creator>Kev</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = false;
    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is my advertising_init function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192494?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 18:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cde84e79-8b0a-4561-a9bc-27574a673180</guid><dc:creator>Kev</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void Button_Handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action){   
      ready_to_flash_led = true ;
      SET_LED(LED_1, ON);
}

while(1){
      
    if(ready_to_flash_led == true ){
           
          write_flash_led(0x30);
          ready_to_flash_led = false;       
    }        
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is my button handler. When i press button LED goes on, but in main while loop on if sentence doesnt trigger writing to flash function. If i run code in beacon mode or advertising in idle mode it goes into while loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping advertising</title><link>https://devzone.nordicsemi.com/thread/192490?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 18:46:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55ede6ce-41bd-45e3-ba77-9e6ca21732e1</guid><dc:creator>awneil</dc:creator><description>[quote userid="76961" url="~/f/nordic-q-a/48525/stopping-advertising"]program cant go in while loop in main while advertising is running[/quote]
&lt;p&gt;What, exactly, do you mean by that.&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t seem to make much sense - pretty much all of the SDK examples enter their main while loop while they are advertising!&lt;/p&gt;
&lt;p&gt;To Stop (and re-start) advertising, see:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48461/restart-advertisement-timeout-before-its-actual-timeout-restart-whenever-there-is-a-button-press"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/48461/restart-advertisement-timeout-before-its-actual-timeout-restart-whenever-there-is-a-button-press&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>