Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 17.0.2, S140 7.2.0 already initialized? sd_softdevice_enable error 0x1001 causes nrf_sdh_enable_request to hang

Having trouble calling ble_stack_init in SDK 17.0.2 with s140 7.2. 

The application compiles but hangs up on the error check after nrf_sdh_enable_request and outputs garbage characters to the debug terminal.

Looking further, I can see that sd_softdevice_enable is returning 0x1001 instead of NRF_SUCCESS but for some reason the nrf_sdh_enable_request doesn't seem to be returning this value and hence the error check just hangs. 

The error returned by sd_softdevice_enable is confusing me as well. Looking at the docs, this seems to be because either there's a IRQ_PRIORITY violation, the SoftDevice is already initialized, or the LF_CLOCK source is incorrect. I've looked into all three of these scenarios and haven't come up with anything. All my IRQ_PRIORITIES in sdk_config are all set to 6, I've confirmed my LF_CLOCK source is correct, and despite my efforts I cannot seem to find how or why the SoftDevice may already be initialized before I call ble_stack_init(). 

I've even added a nrf_sdh_is_enabled function call just before the nrf_sdh_enable_request which I can see in the debugger returns as false. So I am totally at a loss. 

Here's my main loop:

int main(void)
{
    // Initialize.
    log_init();
    //NRF_LOG_INFO("Logs initialized");
    timer_init();
    leds_init();
    saadc_init();
    saadc_sampling_event_init();
    saadc_sampling_event_enable();
    buttons_init();
    power_management_init();
    ble_stack_init();
    gatt_init();
    peer_manager_init(true);
    db_discovery_init();
    lbs_c_init();
    ble_conn_state_init();
    scan_init();
    
    scan_start();

    // Start execution.


    while (true)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            idle_state_handle();
        }
    }
}

Any help would be appreciated,

Thanks,

Sam

Parents
  • Hi,

    As you say, error code 1001 means: NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.

    I could try to remove/comment out the other functions prior to the SD inir, starting with the SAADC code before the init, and see if the error goes away.

    Also, what toolchain are you using? And do you have the SOFTDEVICE_PRESENT flag in your preprocessor symbols?

Reply
  • Hi,

    As you say, error code 1001 means: NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.

    I could try to remove/comment out the other functions prior to the SD inir, starting with the SAADC code before the init, and see if the error goes away.

    Also, what toolchain are you using? And do you have the SOFTDEVICE_PRESENT flag in your preprocessor symbols?

Children
No Data
Related