Can't disable Softdevice in ble_app_uart

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 by funtion nrf_sdh_is_enabled(), RTT print SD still enable. And right away, I receiver Fatal error by timeout of button

This is my code : 

    // Enter main loop.
    for (;;)
    {
        UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
        if(disable_SD)
        {
            disable_SD = false;
            uint8_t res = 0;
            uint32_t err_code = sd_softdevice_disable();
            APP_ERROR_CHECK(err_code);
            res = nrf_sdh_is_enabled();
            if(res == 1)
            {
                NRF_LOG_INFO("SD is enable");
            }
            else
            {
                NRF_LOG_INFO("SD is disable");
            }  
        }
        idle_state_handle();
    }

Thank !!

Parents Reply Children