<?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>LPCXpresso IDE中的主题 Re: Multitask error @uart example</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Multitask-error-uart-example/m-p/531450#M2499</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_USA on Tue Feb 15 11:13:46 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The UART driver code is not re-entrant. In a multitasking environment it should be placed into a single resource-management thread or the global variables should be replaced with semaphores. I am not certain moving the "UART3TxEmpty" assignment will completely work around this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-NXP&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:55:04 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:55:04Z</dc:date>
    <item>
      <title>Multitask error @uart example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Multitask-error-uart-example/m-p/531449#M2498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wortel on Mon Feb 14 05:02:38 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In the UART example it is possible to end in a endless loop when using priority interrupts and/or FreeRtOS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the part:&lt;/SPAN&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* THRE status, contain valid data */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ( !(UART1TxEmpty &amp;amp; 0x01) );&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART1-&amp;gt;THR = *BufferPtr;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART1TxEmpty = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* not empty in the THR until it shifts out */
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;it should be like this:&lt;/SPAN&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* THRE status, contain valid data */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ( !(UART3TxEmpty &amp;amp; 0x01) );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART3TxEmpty = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* not empty in the THR until it shifts out */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART3-&amp;gt;THR = *BufferPtr;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;Else it is possible to have the character send already, where the interrupt services that the Empty bit gets Empty = 1;, and where later on the running code then clears the bit. Resulting in a endless loop the next time that you will send a char, since the interrupt was already done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it OK that I post this error? Or isn't it appropriated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:55:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Multitask-error-uart-example/m-p/531449#M2498</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Multitask error @uart example</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Multitask-error-uart-example/m-p/531450#M2499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_USA on Tue Feb 15 11:13:46 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The UART driver code is not re-entrant. In a multitasking environment it should be placed into a single resource-management thread or the global variables should be replaced with semaphores. I am not certain moving the "UART3TxEmpty" assignment will completely work around this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-NXP&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:55:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Multitask-error-uart-example/m-p/531450#M2499</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:55:04Z</dc:date>
    </item>
  </channel>
</rss>

