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

sd_mutex and "App High" interrupt priority example

I am looking for some guidance and an example on how to use the sd_mutex related functions. So far, I keep getting into the HardFault_Handler whenever I call sd_mutex_acquire.

I'm pretty sure this has something to do with the main/interrupt/event thread context that I am calling from (main), but I can't seem to find a good description of the rules for calling these apis. I do see a short section in the reference manual appendix (quoted below) but it doesn't really make sense to me since it seems to suggest that I should be able to call the api from any interrupt level (including main) that is lower than the SOFTDEVICE's UpperStack interrupt priority (2). Thus, I would think that I should be able to call from MAIN or Application Low (3) priorities.

Is there any documentation that describes these rules better than the following brief description in the reference manual appendix?:

"SVC calls are conceptually software triggered interrupts with a procedure call standard for parameter passing and return values. Each API call generates an interrupt allowing single-thread API context and SoftDevice function locations to be independent from the application perspective at compile-time. SoftDevice API functions can only be called from lower interrupt priority when compared to the SVC priority. See the Exception (interrupt) management with a SoftDevice section on page 190."

Also, on a somewhat related topic, I would be very interested in seeing an example that uses Application High (P1) interrupt priority since I am having a lot of issues dealing with interrupt latency when the SOFTDEVICE is enabled.

Related