<?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>Can&amp;#39;t disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46114/can-t-disable-softdevice-in-ble_app_uart</link><description>Hi all, 
 I want to disable SD and reinit SD and reinit my services. 
 I try by ble_app_uart example. 
 I add code for button, when I press button 1, it disable SD. When I press button 2, it reinit SD and my service. 
 But when I disable SD and check</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Apr 2019 07:49:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46114/can-t-disable-softdevice-in-ble_app_uart" /><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/183005?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 07:49:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:780f8900-8098-430a-8283-e71c3de1ad06</guid><dc:creator>Giang</dc:creator><description>&lt;p&gt;Thank for reply,&lt;/p&gt;
&lt;p&gt;I continue encounter other problem relate app_timer in below thread. Please read it. Thank !!&lt;/p&gt;
&lt;pre class="tw-data-text tw-ta tw-text-medium" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/46455/app-timer-and-disable-softdevice-problems"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/46455/app-timer-and-disable-softdevice-problems&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/182993?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 07:28:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0795baa-8344-4c16-a4c1-2b88d9257a5c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Please have a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/42207/start-and-stop-advertising-with-dfu-service"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/182725?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2019 10:19:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:040e0bae-1202-4e8d-a24e-54d34ead11a8</guid><dc:creator>Giang</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/joh2"&gt;J&amp;oslash;rgen Holmefjord&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;I have a trouble, In my project have DFU service and I want to disable SD and enable SD while chip running.&lt;/p&gt;
&lt;p&gt;But DFU have function :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context)
{
	NRF_LOG_INFO(&amp;quot;System OFF&amp;quot;);
   if (state == NRF_SDH_EVT_STATE_DISABLED)
   {
       // Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
       nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);

       //Go to system off.
       nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
   }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And when I disable SD and want to enable SD after that. But my code will jump to above function and put chip to system off. And chip will not enable SD after that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So How I can use both function disable SD for reset GATT table and use DFU.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please show me a solution&lt;/p&gt;
&lt;p&gt;Thank you !!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/182638?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 13:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0feab19-e9c3-46c0-a9af-529b345a6621</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I understand your question. If you disable the softdevice, you will get errors if you try to call softdevice API functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/182316?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 10:04:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1f7890d-1ff0-40c3-8289-6d099a3a8392</guid><dc:creator>Giang</dc:creator><description>&lt;p&gt;I did. It worked. I want to ask in my code :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;            else if(running_mode == NONE_MODE)
            {
              NRF_LOG_INFO(&amp;quot;None mode&amp;quot;);
              bsp_indication_set(BSP_INDICATE_IDLE);
              bsp_indication_set(BSP_INDICATE_CONNECTED);
              // Stop any impending connection parameters update.
              // Stop all timer use for update paramater of connection
              uint32_t err_code = ble_conn_params_stop();
              APP_ERROR_CHECK(err_code);

              // Disable the softdevice stack.
              ble_stack_stop();

              // Request Low frequency clock to re-enable the clock after the softdevice stops it.
              nrf_drv_clock_lfclk_request(NULL);
            }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If I comment line :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint32_t err_code = ble_conn_params_stop();&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;I will receiver many hardfault. Such as :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;err_code = sd_power_system_off();&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;err_code = ble_conn_params_init(&amp;amp;cp_init);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;static void conn_params_error_handler(uint32_t nrf_error)&lt;br /&gt;{&lt;br /&gt; APP_ERROR_HANDLER(nrf_error);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;So, can you tell me What happen ?&lt;/p&gt;
&lt;p&gt;Thank!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/182301?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 09:05:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7b2c1f0-2cf0-46e5-8522-6722d68b5d38</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you look in the ble_app_gzll example, they store a flag that say if Queued write module have been initialized. You will have to do something similar:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Flag that prevents from Queued Write module reinitialization.
static bool        qwr_initialized = false;

uint32_t           err_code;
nrf_ble_qwr_init_t qwr_init = {0};

if (!qwr_initialized)
{
    // Initialize the Queued Write module.
    qwr_init.error_handler = nrf_qwr_error_handler;

    err_code = nrf_ble_qwr_init(&amp;amp;m_qwr, &amp;amp;qwr_init);
    APP_ERROR_CHECK(err_code);

    qwr_initialized = true;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/181930?ContentTypeID=1</link><pubDate>Sat, 13 Apr 2019 08:24:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd4ddd14-6a4b-4023-9a00-8eba1df6e494</guid><dc:creator>Giang</dc:creator><description>&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt;I have a problem when try enable stack and reinit service.&lt;/p&gt;
&lt;p&gt;I follow ble_app_gzll, this my code :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_stack_start(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    ASSERT(nrf_sdh_is_enabled());

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}

static void ble_stack_stop(void)
{
    uint32_t err_code;

    err_code = nrf_sdh_disable_request();
    APP_ERROR_CHECK(err_code);

    bool res = nrf_sdh_is_enabled();
    if(res)
    {
        NRF_LOG_INFO(&amp;quot;SD enabled&amp;quot;);
    }
    else{
        NRF_LOG_INFO(&amp;quot;SD disabled&amp;quot;);
    }
}

void ble_nus_start(void)
{
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
    advertising_start();
}

#define BLE_MODE  0
#define NONE_MODE 1

uint8_t running_mode = 0;
uint8_t previous_mode  = 0;


/**@brief Application main function.
 */
int main(void)
{
    bool erase_bonds;

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
  
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    // Start execution.
    printf(&amp;quot;\r\nUART started.\r\n&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Debug logging for UART over RTT started.&amp;quot;);
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
        if (bsp_button_is_pressed(BLE_MODE))
        {
            running_mode  = BLE_MODE;
        }
        else if (bsp_button_is_pressed(NONE_MODE))
        {
            running_mode  = NONE_MODE;
        }     
        if(previous_mode != running_mode)
        {
            previous_mode = running_mode;
            if(running_mode == BLE_MODE)
            { 
              NRF_LOG_INFO(&amp;quot;BLE mode&amp;quot;);

              // Disable low frequency clock. Readying for softdevice startup.
              nrf_drv_clock_lfclk_release();

              // Clean up after Gazell.
              NVIC_DisableIRQ(RADIO_IRQn);
              NVIC_DisableIRQ(TIMER2_IRQn);
              NVIC_DisableIRQ(SWI0_IRQn);
              NVIC_ClearPendingIRQ(RADIO_IRQn);
              NVIC_ClearPendingIRQ(TIMER2_IRQn);
              NVIC_ClearPendingIRQ(SWI0_IRQn);

              // Re-enable the softdevice stack.
              ble_stack_start();
              ble_nus_start();
            }
            else
            {
              NRF_LOG_INFO(&amp;quot;None mode&amp;quot;);

              // Disable the softdevice stack.
              ble_stack_stop();

              // Request Low frequency clock to re-enable the clock after the softdevice stops it.
              nrf_drv_clock_lfclk_request(NULL);
            }
         }
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When I reinit, run to services_init(), I receiver error by funtion&amp;nbsp;nrf_ble_qwr_init() return&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if (MODULE_INITIALIZED)&lt;br /&gt; {&lt;br /&gt; return NRF_ERROR_INVALID_STATE;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;because&amp;nbsp;&lt;span&gt;MODULE_INITIALIZED. So why&amp;nbsp;ble_nus_init() not error but&amp;nbsp;nrf_ble_qwr_init() return error.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please show me a solution ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank!!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/181895?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 15:53:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:414f4e61-8598-4c0b-9e58-ddec9e7ecdcb</guid><dc:creator>Giang</dc:creator><description>&lt;p&gt;Yes, It can disable SD. Then, I can&amp;#39;t use button interrupt . So, can you tell me when I disable SD, What is also disable ?&lt;/p&gt;
&lt;p&gt;If I want to reinit my services, what&amp;nbsp; do I need reinit ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank !!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't disable Softdevice in ble_app_uart</title><link>https://devzone.nordicsemi.com/thread/181861?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 13:13:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3bb06c4-8917-42fd-937a-6e8614824588</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If softdevice have been enabled through the softdevice handler library with call to&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__sdh.html#ga574d17fdf1c59dec6355e3f525c484ec"&gt;nrf_sdh_enable_request&lt;/a&gt;(), you should also make sure to disable it using the same API with&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__sdh.html#ga38fb7087993c1e6eae22c0e00725640e"&gt;nrf_sdh_disable_request&lt;/a&gt;(). Failing to do so will leave the softdevice handler in the wrong state and give you errors.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>