<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Implementing a mutex</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/279/implementing-a-mutex</link><description>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?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Aug 2013 04:53:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/279/implementing-a-mutex" /><item><title>RE: Implementing a mutex</title><link>https://devzone.nordicsemi.com/thread/1492?ContentTypeID=1</link><pubDate>Thu, 15 Aug 2013 04:53:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b83c6d32-9dba-464c-a8d1-fb17eec0bfd8</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Please see my separate answer, which most likely explains why this happens.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing a mutex</title><link>https://devzone.nordicsemi.com/thread/1491?ContentTypeID=1</link><pubDate>Thu, 15 Aug 2013 04:53:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c48eec2-90a2-4824-b7a2-2b7b831fb183</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Remember that softdevice functions can only be called from interrupt with priority 3 and the main context, not from interrupts with priority 2. See &lt;a href="https://devzone.nordicsemi.com/index.php/how-to-redefine-ppi-tasks-inside-a-timer-interrupt#reply-804"&gt;this answer&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;Edit: You can change the priority of interrupts with the sd_nvic_SetPriority() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing a mutex</title><link>https://devzone.nordicsemi.com/thread/1490?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2013 19:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39bd2ecb-138c-4aae-92b6-9fd29cce2fb6</guid><dc:creator>Guilherme de Paula</dc:creator><description>&lt;p&gt;I&amp;#39;ve tried that but when calling &amp;quot;sd_mutex_acquire()&amp;quot; in the handler code it goes into HardFault.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing a mutex</title><link>https://devzone.nordicsemi.com/thread/1489?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2013 08:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ecbd436-6842-414a-af24-020106c9b857</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Are you using the SoftDevice?&lt;/p&gt;
&lt;p&gt;If so, there are already SVCs provided by the SoC framework that implement mutexes and critical regions:&lt;/p&gt;
&lt;p&gt;sd_mutex_new
sd_mutex_acquire
sd_mutex_release&lt;/p&gt;
&lt;p&gt;sd_nvic_critical_region_enter
sd_nvic_critical_region_exit&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Carles&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>