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

error code 0x4001 from sd_clock_hfclk_request

I'm getting the error code 0x4001 from sd_clock_hfclk_request and I can't find where the error codes are defined/explained for this function. Can someone point me in the right direction?

I suspect something has to be initialized in the SoftDevice before I can call this function but I can't find any documentation that states what that would be.

Thanks, Bret

Parents
  • Hi,

    The return values for sd_clock_hfclk_request() can be found here.

    The only return value it should have is SUCCESS, however this appears to not be the case for you. You could try initializing the SoftDevice by calling SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false); instead, note that this function will take some time since it starts up the LFCLK.

    Make sure that you also wait for the crystal to start up before doing anything else.

    uint32_t running = 0;
    sd_clock_hfclk_request();
    while(! p_is_running)
    {          
        // Wait for the crystal to start                  
        sd_clock_hfclk_is_running((&p_is_running));
    }
    

    Best regards,

    Øyvind

Reply
  • Hi,

    The return values for sd_clock_hfclk_request() can be found here.

    The only return value it should have is SUCCESS, however this appears to not be the case for you. You could try initializing the SoftDevice by calling SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false); instead, note that this function will take some time since it starts up the LFCLK.

    Make sure that you also wait for the crystal to start up before doing anything else.

    uint32_t running = 0;
    sd_clock_hfclk_request();
    while(! p_is_running)
    {          
        // Wait for the crystal to start                  
        sd_clock_hfclk_is_running((&p_is_running));
    }
    

    Best regards,

    Øyvind

Children
No Data
Related