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

Softdevice stucks when using external crystal

Hi, I'm developing app using nrf51822. I want to use BT, but my program stops working (stucks) on softdevice setup. I'm using external 32 MHz crystal. I will be happy for any advice. I attach scheme and code sample. The same code (except frequency setting - used 16 MHz insted of 32 MHz) is running ok on dongle.

Thanks Marek

Crystal I'm using

scheme

 static void ble_stack_init(void)
 {
    uint32_t err_code;
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false); <-- here program stucks
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
 }

int main(void)
{
        NRF_CLOCK->XTALFREQ = 0x0;
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {}
    
        timers_init();
        gpiote_init();
        bond_manager_init();
        ble_stack_init(); <-- here is called SOFTDEVICE_HANDLER_INIT
        gap_params_init();
        advertising_init();
        alert_notification_init();
}
Related