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

[SoftDevice] Is there any limitation to call sd_clock_hfclk_release, when ADC

Hi,

I run ADC mudule together with SD, but go into hardfault eatch when I release the HF-clock.

Chip: 51822 SDK : 10.0-alpha IDE : Keil-472

image description

I use this function to request the high frequence clock for ADC, befer the convertation

__INLINE void request_HFCLK_4_ADC ( void ) {
    uint32_t p_is_running = 0;
    
    sd_clock_hfclk_request();
    while(! p_is_running) {  							//wait for the hfclk to be available
        sd_clock_hfclk_is_running((&p_is_running));
    }
}

Then call

__INLINE void release_HFCLK_4_ADC ( void ) {
    //sd_clock_hfclk_release();
}

when ADC complete.

But the release funcion will always cause an hardfaul.

I wonder is there some limitition to use this API?

Thanks,

Parents
  • Hi,

    Thanks for your direct. I changed the ADC_Handler priority from NRF_APP_PRIORITY_HIGH to NRF_APP_PRIORITY_LOW, it can works well now.

    But, I'm puzzled about why this cause the hard-fault. I think if give ADC more priority, then it can hold more resource, then other module/thread will not change the status, it's more safe for the ADC caller to release the clock. I cant explain by myself.

    And more question. Is the status check is necessary when I call sd_clock_hfclk_release.

Reply
  • Hi,

    Thanks for your direct. I changed the ADC_Handler priority from NRF_APP_PRIORITY_HIGH to NRF_APP_PRIORITY_LOW, it can works well now.

    But, I'm puzzled about why this cause the hard-fault. I think if give ADC more priority, then it can hold more resource, then other module/thread will not change the status, it's more safe for the ADC caller to release the clock. I cant explain by myself.

    And more question. Is the status check is necessary when I call sd_clock_hfclk_release.

Children
No Data
Related