<?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>Problem with advertising reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16606/problem-with-advertising-reset</link><description>Hi,
I try to turn off the advertising after the first connection and then turn it on after pressing the button, this is what I wrote: 
 void radio_notification_evt_handler(bool radio_evt)
{
 if (radio_evt)
 {
 //radio going active
 LEDS_INVERT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Sep 2016 15:04:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16606/problem-with-advertising-reset" /><item><title>RE: Problem with advertising reset</title><link>https://devzone.nordicsemi.com/thread/63528?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 15:04:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fddc908e-dd58-4d7b-99f2-63e665bbed8e</guid><dc:creator>AndrzejB</dc:creator><description>&lt;p&gt;Thank you!  I changed priority to 3 and now everything works fine :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with advertising reset</title><link>https://devzone.nordicsemi.com/thread/63526?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 14:53:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb178e19-46e9-4f43-82a1-248cfe7ed247</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;I am not familiar with advertising module (i just don&amp;#39;t use it to advertise), but i think this is because you cannot call SVC from higher priority context. I assume your GPIOTE IRQ have higher priority than SVC, so it causes hardfault. You just have to leave somehow from interrupt context (just set a flag in irq handler?) and start advertising by checking the flag. about ble_evt_dispatch and sys_evt_dispatch - they are used to propagate BLE and SOC events in app, you can read about it &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/group__ble__stack__handler__types.html?cp=4_0_0_6_7_36_1_3#gae54951e939156d5f05fa4d27fed1dc65"&gt;here&lt;/a&gt; and &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/group__softdevice__handler.html?cp=4_0_0_6_7_36_17#ga200d4e1f1c70a46e6de6343f0a7d84b1"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with advertising reset</title><link>https://devzone.nordicsemi.com/thread/63529?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 14:40:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0a7f0f3-1d7f-4991-99bd-c232a09c1cb1</guid><dc:creator>AndrzejB</dc:creator><description>&lt;p&gt;Yes, you are right, my mistake. Function ble_advertising_on_ble_evt in ble_evt_dispatch starts the advertising after connection end and after I remove this function I don&amp;#39;t need to stop advertising manually. However, I still can&amp;#39;t start advertising in GIOTE_IRQHandler, and I don&amp;#39;t know why. Beneath I placed sys_evt_dispatch and ble_evt_dispatch, maybe there is a reason why it not working (in fact I have trouble to fully understand these functions, particularly when these functions are calling)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    dm_ble_evt_handler(p_ble_evt);
    ble_conn_params_on_ble_evt(p_ble_evt);
    on_ble_evt(p_ble_evt);
    ble_our_service_on_ble_evt(&amp;amp;m_our_service, p_ble_evt);
}


static void sys_evt_dispatch(uint32_t sys_evt)
  {
        pstorage_sys_event_handler(sys_evt);
        ble_advertising_on_sys_evt(sys_evt);
        if (sys_evt == NRF_EVT_POWER_FAILURE_WARNING)
        {
    	sd_power_dcdc_mode_set(NRF_POWER_DCDC_DISABLE);
        }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with advertising reset</title><link>https://devzone.nordicsemi.com/thread/63527?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 13:27:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98316423-7d4d-4d18-9861-3b679a0f0aee</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;As far as i know, advertising is automatically stopped after connection. You sure you need to stop it manually?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>