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

NRF51822 sd_softdevice_enable freeze SDK 12.3 SD130 v2.0.1

My app runs the following code, that is supposed to init the SoftDevice:

nrf_clock_lf_cfg_t clock_lf_cfg = {
.source = NRF_CLOCK_LF_SRC_XTAL,
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM,
};

// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT (&clock_lf_cfg, NULL);

Inside the last macro, the call to sd_softdevice_enable() freezes and never returns, nor jumps to the softdevice_fault_handler.

I have already tried executing the following code to successfully ensure that the lfck is running:

bool started = nrf_drv_clock_lfclk_is_running();

NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;

while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
{
// Do nothing.
}
started = nrf_drv_clock_lfclk_is_running();

Yet, sd_softdevice_enable freezes.

Is there anything i can do to get the code up and running?

It only started to freeze on a new board, on another board it worked.

I do sadly not have any technical documentation about the current board, though...

Related