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

NRF52 SDK14.0 sd_softdevice_enable() freezes if nrf_drv_clock_lfclk_request() was called before

I am using NRF52 SDK14.0 and SoftDevice S132 v5.0.0. Application freezes somewhere in SoftDevice if sd_softdevice_enable() is called after nrf_drv_clock_lfclk_request() was called before. If using a debugger, you can pause while frozen and if you hit run again, the application continues flawlessly. It seems it is stuck in some strange loop inside SoftDevice. If you are not using nrf_drv_clock_lfclk_request() before starting SoftDevice, everything works just fine.

Parents
  • I found a way to reproduce this behavior in ble_app_hrs_freertos example. In file main.c comment everything inside of clock_init(void) function:

    static void clock_init(void)
    {
        //ret_code_t err_code = nrf_drv_clock_init();
        //APP_ERROR_CHECK(err_code);
    }
    

    and then add following lines around line 1045:

    // Activate deep sleep mode.
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    nrf_drv_clock_lfclk_request(NULL);
    for (volatile uint32_t i=0; i<1000000; i++);
    // Configure and initialize the BLE stack.
    ble_stack_init();
    

    Compile using GCC and you will see the exact behavior I am facing in my app.

Reply
  • I found a way to reproduce this behavior in ble_app_hrs_freertos example. In file main.c comment everything inside of clock_init(void) function:

    static void clock_init(void)
    {
        //ret_code_t err_code = nrf_drv_clock_init();
        //APP_ERROR_CHECK(err_code);
    }
    

    and then add following lines around line 1045:

    // Activate deep sleep mode.
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    nrf_drv_clock_lfclk_request(NULL);
    for (volatile uint32_t i=0; i<1000000; i++);
    // Configure and initialize the BLE stack.
    ble_stack_init();
    

    Compile using GCC and you will see the exact behavior I am facing in my app.

Children
No Data
Related