This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Unable to enable the softdevice on custom board.

Hi,

I'm using a nrf52 custom board based out of the telit bluemod s42. I'm trying to port the ble_app_uart example of the SDK14 onto the custom board. The code seems to be getting stuck at the function nrf_sdh_enable_request(void) present in the ble_stack_init function.

nrf_sdh_enable_request(void) is shown below :

ret_code_t nrf_sdh_enable_request(void)
{
    ret_code_t ret_code;

    if (m_nrf_sdh_enabled)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    m_nrf_sdh_continue = true;

    // Notify observers about SoftDevice enable request.
    if (sdh_request_observer_notify(NRF_SDH_EVT_ENABLE_REQUEST) == NRF_ERROR_BUSY)
    {
        // Enable process was stopped.
        return NRF_SUCCESS;
    }

    // Notify observers about starting SoftDevice enable process.
    sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLE_PREPARE);

    nrf_clock_lf_cfg_t const clock_lf_cfg =
    {
        .source        = NRF_SDH_CLOCK_LF_SRC,
        .rc_ctiv       = NRF_SDH_CLOCK_LF_RC_CTIV,
        .rc_temp_ctiv  = NRF_SDH_CLOCK_LF_RC_TEMP_CTIV,
    #ifdef S132
        .accuracy      = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
    #else
        .xtal_accuracy = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
    #endif
    };

    #ifdef ANT_LICENSE_KEY
        ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler, ANT_LICENSE_KEY);
    #else
        ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler);
    #endif

    if (ret_code != NRF_SUCCESS)
    {
        return ret_code;
    }

    m_nrf_sdh_enabled   = true;
    m_nrf_sdh_continue  = false;
    m_nrf_sdh_suspended = false;

    // Enable BLE event interrupt (interrupt priority has already been set by the stack).
#ifdef SOFTDEVICE_PRESENT
    ret_code = sd_nvic_EnableIRQ((IRQn_Type)SD_EVT_IRQn);
    if (ret_code != NRF_SUCCESS)
    {
        return ret_code;
    }
#else
    //In case of serialization, NVIC must be accessed directly.
    NVIC_EnableIRQ(SD_EVT_IRQn);
#endif

    // Notify observers about a finished SoftDevice enable process.
    sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);

    return NRF_SUCCESS;
}

Program was getting stuck at the ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler); I then changed the clk settings to : image description

Now the code jumps to

if (sdh_request_observer_notify(NRF_SDH_EVT_ENABLE_REQUEST) == NRF_ERROR_BUSY)
    {
        // Enable process was stopped.
        return NRF_SUCCESS;
    }

after executing statement :

// Notify observers about a finished SoftDevice enable process.
    sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);

and is stuck in the nrf_sdh_enable_request(void) function.

Could you please let me know if any other configuration changes are required to run the softdevice. I'm using softdevice v 5.0.0 which came with the sdk 14.0.0

Parents
  • Then I recommend you to try to debug a bit more. Turn off optimizations. You are both saying that you are not getting past sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);?

    sdh_state_observer_notify() should notify sd_state_evt_handler() in nrf_drv_clock.c and nrf_fstorage_sdh_state_handler() in nrf_fstorage_sd.c

    If you put breakpoints in these? Are they hit? If they are, are you getting through the function?

Reply
  • Then I recommend you to try to debug a bit more. Turn off optimizations. You are both saying that you are not getting past sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);?

    sdh_state_observer_notify() should notify sd_state_evt_handler() in nrf_drv_clock.c and nrf_fstorage_sdh_state_handler() in nrf_fstorage_sd.c

    If you put breakpoints in these? Are they hit? If they are, are you getting through the function?

Children
No Data
Related