<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPC4357 Exclusive Access Issue in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571902#M18481</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Thu Sep 25 12:36:48 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Why would that cause a problem? By definition, you already have exclusive access. Given this is published by ARM, I'd be pretty confident that it works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:55:55 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:55:55Z</dc:date>
    <item>
      <title>LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571899#M18478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Sal Ammoniac on Wed Sep 24 21:36:39 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;My RTOS has a small assembly procedure to set a memory location using the Cortex-M4's exclusive access feature. It uses this in the mutex lock function. The code is in the code block below. On extremely rare occasions, it fails to set the memory location passed to in in R0, I'm running this code with interrupts turned off as the Cortex-M4 instruction set manual says that an interrupt between the ldrex and strex instructions resets the exclusive access monitor. I'm not using DMA and I'm not using the Cortex-M0 in the 4357.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any other reason why this code should fail when called with the memory location pointed to by R0 is already 0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp; .thumb_func
setmutex:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldrex r1,[r0]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // initiate exclusive access
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cbnz&amp;nbsp; r1,1f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // branch if it's already set
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov&amp;nbsp;&amp;nbsp; r2,#1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strex r1,r2,[r0]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // try setting location to 1
1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov&amp;nbsp;&amp;nbsp; r0,r1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set return value = 0 if set succeeded, 1 if set failed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bx&amp;nbsp;&amp;nbsp;&amp;nbsp; lr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // return
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571899#M18478</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571900#M18479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Thu Sep 25 00:31:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what ARM recommends:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Finfocenter.arm.com%2Fhelp%2Findex.jsp%3Ftopic%3D%2Fcom.arm.doc.dai0321a%2FBIHEJCHB.html" rel="nofollow" target="_blank"&gt;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHEJCHB.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571900#M18479</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571901#M18480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Sal Ammoniac on Thu Sep 25 11:18:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks. I wasn't aware that a DMB instruction was needed when using the exclusive access instructions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting, too, that the example code clears the lock just by setting it to zero rather than using the exclusive access instructions. Seems to me like this would cause a problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571901#M18480</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571902#M18481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Thu Sep 25 12:36:48 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Why would that cause a problem? By definition, you already have exclusive access. Given this is published by ARM, I'd be pretty confident that it works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571902#M18481</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571903#M18482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Sal Ammoniac on Thu Sep 25 13:04:23 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You're right. For mutexes it's fine. It wouldn't work for counting semaphores, however.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571903#M18482</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 Exclusive Access Issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571904#M18483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Thu Sep 25 13:22:01 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;There's probably a billion other things it wouldn't work for. But it wasn't designed for those either.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-Exclusive-Access-Issue/m-p/571904#M18483</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:56Z</dc:date>
    </item>
  </channel>
</rss>

