<?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: Using FIFO Rx/TX buffers of UART  in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500829#M12751</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;There is a UART FIFO demo , &lt;A href="https://community.nxp.com/thread/374543"&gt;How do you properly clear the UART RX FIFO?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;this is a bare board project without any drivers .&lt;/P&gt;&lt;P&gt;Dose this can help you ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Apr 2016 02:56:10 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2016-04-14T02:56:10Z</dc:date>
    <item>
      <title>Using FIFO Rx/TX buffers of UART</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500828#M12750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have K60 F120 tower. I want to use UART Rx/Tx buffers. I have setup and enable Rx/Tx as follows:&lt;/P&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style=""&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;//Clear RE/TE&lt;/P&gt;&lt;P&gt;UART5_C2 &amp;amp;= (uint8_t)(~(uint8_t)(UART_C2_RE_MASK | UART_C2_TE_MASK) ); &lt;/P&gt;&lt;P&gt;//Flush Rx/Tx FIFO Buffer&lt;/P&gt;&lt;P&gt;UART5_CFIFO &amp;amp;=(uint8_t)(~(uint8_t)(UART_CFIFO_RXFLUSH_MASK | UART_CFIFO_TXFLUSH_MASK));&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//Enable Rx/Tx FIFO Buffer&lt;/P&gt;&lt;P&gt;UART5_PFIFO |= ( UART_PFIFO_TXFE_MASK | UART_PFIFO_RXFE_MASK );&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//Set 128 DataWords Rx/Tx FIFO Buffer&lt;/P&gt;&lt;P&gt;UART5_PFIFO |= ( UART_PFIFO_RXFIFOSIZE(6) | UART_PFIFO_TXFIFOSIZE(6));&lt;/P&gt;&lt;P&gt;UART5_S1;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//Flush Rx/Tx FIFO Buffer&lt;/P&gt;&lt;P&gt;UART5_CFIFO &amp;amp;=(uint8_t)(~(uint8_t)(UART_CFIFO_RXFLUSH_MASK | UART_CFIFO_TXFLUSH_MASK));&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//clear RXOF&lt;/P&gt;&lt;P&gt;UART5_SFIFO |= UART_SFIFO_RXOF_MASK;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//Set RE/TE&lt;/P&gt;&lt;P&gt;UART5_C2 |= (uint8_t)(UART_C2_RE_MASK | UART_C2_TE_MASK) ;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can Tx data by writing to D register:&lt;/P&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style=""&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style=""&gt;UART_PDD_PutChar8(UART5_BASE_PTR, pbBuffer[i]);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD style=""&gt;&lt;/TD&gt;&lt;TD style=""&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But a few questions:&lt;/P&gt;&lt;P&gt;TDRE will set when the number of datawords in the transmit buffer (D and C3[T8])is equal to or less than&lt;/P&gt;&lt;P&gt;the number indicated by TWFIFO[TXWATER]. A character that is in the process of being transmitted is not&lt;/P&gt;&lt;P&gt;included in the count. To clear TDRE, read S1 when TDRE is set and then write to the UART data register&lt;/P&gt;&lt;P&gt; (D). &lt;/P&gt;&lt;P&gt;For more efficient interrupt servicing, all data except the final value to be written to the buffer must be&lt;/P&gt;&lt;P&gt;written to D/C3[T8]. Then S1 can be read before writing the final data value, resulting in the clearing of the&lt;/P&gt;&lt;P&gt;TRDE flag. This is more efficient because the TDRE reasserts until the watermark has been exceeded.&lt;/P&gt;&lt;P&gt;So, attempting to clear the TDRE with every write will be ineffective until sufficient data has been written.&lt;/P&gt;&lt;P&gt;0 The amount of data in the transmit buffer is greater than the value indicated by TWFIFO[TXWATER].&lt;/P&gt;&lt;P&gt;1 The amount of data in the transmit buffer is less than or equal to the value indicated by&lt;/P&gt;&lt;P&gt;TWFIFO[TXWATER] at some point in time since the flag has been cleared.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was confusing to me.&lt;/P&gt;&lt;P&gt;Put it simple: if I want to control the FIFO buffer as:&lt;/P&gt;&lt;P&gt;1. disable TX&lt;/P&gt;&lt;P&gt;2. flush FIFO buffer ( may be not necessary, if I know how much is left in the FIFO)&lt;/P&gt;&lt;P&gt;3. put all data into FIFO&lt;/P&gt;&lt;P&gt;4. then go (for transmitting)&lt;/P&gt;&lt;P&gt;5. When Done TX, interrupt triggers.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;David Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2016 19:54:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500828#M12750</guid>
      <dc:creator>davidzhou</dc:creator>
      <dc:date>2016-04-13T19:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using FIFO Rx/TX buffers of UART</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500829#M12751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;There is a UART FIFO demo , &lt;A href="https://community.nxp.com/thread/374543"&gt;How do you properly clear the UART RX FIFO?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;this is a bare board project without any drivers .&lt;/P&gt;&lt;P&gt;Dose this can help you ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2016 02:56:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500829#M12751</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2016-04-14T02:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using FIFO Rx/TX buffers of UART</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500830#M12752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;I have check this thread again ,while i have not check the question you want&lt;/P&gt;&lt;P&gt;to know ， what's the question ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2016 10:15:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500830#M12752</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2016-04-14T10:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using FIFO Rx/TX buffers of UART</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500831#M12753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Alice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&amp;nbsp; Zhou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2016 19:27:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Using-FIFO-Rx-TX-buffers-of-UART/m-p/500831#M12753</guid>
      <dc:creator>davidzhou</dc:creator>
      <dc:date>2016-04-14T19:27:30Z</dc:date>
    </item>
  </channel>
</rss>

