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

Cannot start HF clock after release

Hi.

Device : nRF52820

SDK 17.0.2 ( Softdevice 7.2.0)

I initialized the clock as below to use USB.

ret = nrf_drv_clock_init();
APP_ERROR_CHECK(ret);

nrf_drv_clock_lfclk_request(NULL);

while(!nrf_drv_clock_lfclk_is_running())
{
    /* Just waiting */
}

ble_stack_init();
gap_params_init();
gatt_init();
advertising_init();
services_init();
conn_params_init();
peer_manager_init();

And before changing to sleep mode, the clock was stopped to minimize current consumption. And after wake-up, it tries to run the clock again.

ret_code_t err_code;

//Clock release
nrf_drv_clock_hfclk_release();

err_code = nrf_ble_lesc_request_handler();
APP_ERROR_CHECK(err_code);

//Into sleep mode
nrf_pwr_mgmt_run();

//Wake-up
nrf_drv_clock_hfclk_request(NULL);

But for some reason this doesn't work. 

How do I stop and restart the clock when using USB?

Parents Reply Children
Related