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
  • I re-think about this issue, and guess, could you help me check my thought.

    The fault is not come when I just call the xxxx_release function. But as for the handler has high priority than SVC, it will interrupt the running SVC code. If I close the HF-clock in the ADC-handler, the SVC don't have the required clock when the handler return, so the SVC cause the fault.

    But if it's what I said, why the call stack is in the handler when the fault occur. I had a picture to show the call stack.

    And if I'm right, does this mean that all interrupts should have a lower priority than SVC? Is there any exception?

Reply
  • I re-think about this issue, and guess, could you help me check my thought.

    The fault is not come when I just call the xxxx_release function. But as for the handler has high priority than SVC, it will interrupt the running SVC code. If I close the HF-clock in the ADC-handler, the SVC don't have the required clock when the handler return, so the SVC cause the fault.

    But if it's what I said, why the call stack is in the handler when the fault occur. I had a picture to show the call stack.

    And if I'm right, does this mean that all interrupts should have a lower priority than SVC? Is there any exception?

Children
No Data
Related