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

usbd example hangs at HFCLK request

Hi,

I tried several examples on nrf52840 dongle. Each one works well except usbd example. It hangs at the following code:

nrf_drv_clock_hfclk_request(NULL);
nrf_drv_clock_lfclk_request(NULL);
while (!(nrf_drv_clock_hfclk_is_running() &&
nrf_drv_clock_lfclk_is_running()))
{
/* Just waiting */
}
After investigation, the following simple code hangs at hfclk request:
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));

    NRF_LOG_DEFAULT_BACKENDS_INIT();


    err_code = nrf_drv_clock_init();
    if ((err_code != NRF_SUCCESS) &&
        (err_code != NRF_ERROR_MODULE_ALREADY_INITIALIZED))
    {
        APP_ERROR_CHECK(err_code);
    }

		nrf_gpio_cfg_output(LED2_R);

    nrf_gpio_pin_clear(LED2_R);
    
		
    nrf_drv_clock_hfclk_request(NULL);
    while (!nrf_drv_clock_hfclk_is_running())
    {}


    nrf_gpio_cfg_output(LED2_B);

    nrf_gpio_pin_clear(LED2_B);
    
    while(true) {
        
    }
}
LED_B never light.
The following is the step:
1) open usbd project
2) change main.c like the above
3) change 10056 to 10059
4) change ROM1 to 0x1000 and size is 0xFF000
5) compile and use DFU to upload to dongle
Related