I need a mutex and I found this information at the ARM site: infocenter.arm.com/.../index.jsp
Is there anything I should be aware of in using this technique to implement a mutex?
I need a mutex and I found this information at the ARM site: infocenter.arm.com/.../index.jsp
Is there anything I should be aware of in using this technique to implement a mutex?
Hi there,
Are you using the SoftDevice?
If so, there are already SVCs provided by the SoC framework that implement mutexes and critical regions:
sd_mutex_new sd_mutex_acquire sd_mutex_release
sd_nvic_critical_region_enter sd_nvic_critical_region_exit
Regards,
Carles
I've tried that but when calling "sd_mutex_acquire()" in the handler code it goes into HardFault.
To answer the original question first: I believe that the ARM Cortex M0 does not support the instructions needed to follow that guide in detail, and I would as Carles say therefore recommend you to use the softdevice API functions.
Remember that softdevice functions can only be called from interrupt with priority 3 and the main context, not from interrupts with priority 2. See this answer for more details.
Edit: You can change the priority of interrupts with the sd_nvic_SetPriority() function.
Please see my separate answer, which most likely explains why this happens.