<?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: can't get uart tx fifo to work</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560099#M15705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Jul 30 23:34:59 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;As expected ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LSR_THRE gives you the information that the Transmit Holding Register is [B]empty[/B].&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I.e: the FIFO is empty ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So you are writing one byte to the FIFO, waiting for the fifo to be empty and only then write the next byte.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would have expected something like an LSR_THRF (Transmit Holding Register Full) but I could not find that one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One way to solve this (I don't think this is a nice way to do it but apparantly this is the only way) is to check the LPC_UART-&amp;gt;FIFOLVL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Somehow this register did not pop up in the bookmarks of the PDF file :confused: but it is in chapter 9 ssection 5.21 of the old version of the UM (Rev 00.10 - 11 january 2010) but it got removed from the latest version of the UM ... :eek::(:confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=Red][B]This is something for NXP to explain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The FIFOLVL register is still available in CMSIS version 2[/B][/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;According to the old manual bits 11-8 specify the fill level of the TX FIFO (0x0 - empty, 0xF - full). Bits 3-0 do the same for the RX FIFO.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:16:28 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:16:28Z</dc:date>
    <item>
      <title>can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560098#M15704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ToBeFrank on Sat Jul 30 20:44:25 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got my uart code working fine, however, when measuring it with a scope, it appears the TX fifo is not working. I send a byte with the following code:&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;while ((LPC_UART-&amp;gt;LSR &amp;amp; LSR_THRE) == 0);
LPC_UART-&amp;gt;THR = ch;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I call this in a loop to send the message. I would expect the first 16 bytes to go fast, however I see the first byte take 830ns, the second 2.2us, and the remaining bytes take 84us each. I'm running at 115200 baud so the 84us is consistent with that, but I don't understand why I don't see the first 16 bytes going quick. What am I doing wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Forgot to mention I'm using a LPC11C24.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560098#M15704</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560099#M15705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Jul 30 23:34:59 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;As expected ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LSR_THRE gives you the information that the Transmit Holding Register is [B]empty[/B].&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I.e: the FIFO is empty ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So you are writing one byte to the FIFO, waiting for the fifo to be empty and only then write the next byte.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would have expected something like an LSR_THRF (Transmit Holding Register Full) but I could not find that one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One way to solve this (I don't think this is a nice way to do it but apparantly this is the only way) is to check the LPC_UART-&amp;gt;FIFOLVL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Somehow this register did not pop up in the bookmarks of the PDF file :confused: but it is in chapter 9 ssection 5.21 of the old version of the UM (Rev 00.10 - 11 january 2010) but it got removed from the latest version of the UM ... :eek::(:confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[COLOR=Red][B]This is something for NXP to explain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The FIFOLVL register is still available in CMSIS version 2[/B][/COLOR]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;According to the old manual bits 11-8 specify the fill level of the TX FIFO (0x0 - empty, 0xF - full). Bits 3-0 do the same for the RX FIFO.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560099#M15705</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560100#M15706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Jul 30 23:45:50 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Aahhrrgg...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the same is true for the lpc13xx and lpc17xx series.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The FIFOLVL register is still in CMSIS but not in the new manuals.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dear NXP, please explain what is going on, I did not read anything about a new uart implementation that voids the use of the TX FIFO ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560100#M15706</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560101#M15707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sun Jul 31 06:27:16 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;...it appears the TX fifo is not working...&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;FIFO should work if you enable it: LPC_UART-&amp;gt;FCR = 0x07; //Enable and reset TX and RX FIFO&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately reading FIFO status via FIFOLVL doesn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple workaround is to write 16 bytes to FIFO and then read THRE again.&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;
 void UART_Tx(char *BufferPtr, int Length)
 {
&amp;nbsp; unsigned char tx_data = 0;
&amp;nbsp;&amp;nbsp; while ( Length != 0 )
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!(tx_data % 16))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ( !(LPC_UART-&amp;gt;LSR &amp;amp; LSR_THRE) );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART-&amp;gt;THR = *BufferPtr;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BufferPtr++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tx_data ++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Length--;
&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 22:16:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560101#M15707</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560102#M15708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ToBeFrank on Sun Jul 31 09:17:14 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Rob65&lt;/STRONG&gt;&lt;BR /&gt;As expected ...&lt;BR /&gt;&lt;BR /&gt;LSR_THRE gives you the information that the Transmit Holding Register is [B]empty[/B].&lt;BR /&gt;I.e: the FIFO is empty ...&lt;BR /&gt;So you are writing one byte to the FIFO, waiting for the fifo to be empty and only then write the next byte.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, this makes sense. My confusion comes from the user manual. It states the THR register is for the top byte in the fifo, and that byte will get sent when it makes it to the bottom of the fifo. If that's the case, then THRE should get set when a new space in the fifo has become available. But obviously that's not how it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another question... it appears the THRE interrupt will never fire until you've written a byte into THR. Is this true or is there a way to have it fire without having to write a byte first?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560102#M15708</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560103#M15709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sun Jul 31 14:26:11 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a major flaw in the FIFO implementation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My software can only determine how many bytes it can write when the fifo is empty (THRE) and the Tx interrupt is only fired when the fifo is empty (possibly resulting in a period of silence on the data line ...).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Unfortunately reading FIFO status via FIFOLVL doesn't work.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So this is missing from the Errata sheets ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was still using the old user manual and NXP should have written this flaw down in the errata sheet of the respective chips. Or do they expect me to download and compare new versions of the user manuals each time a new one comes out :confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Another question... it appears the THRE interrupt will never fire until&amp;nbsp; you've written a byte into THR. Is this true or is there a way to have&amp;nbsp; it fire without having to write a byte first? &lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, this is true.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When you use an interrupt based uart, the first byte (or serie of bytes) is written from the non-interrupt routine and you set up the driver such that the rest of the data is sent using the interrupt routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560103#M15709</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560104#M15710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FBUTTY on Sat May 05 05:20:42 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I totally agree.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The manual reads as if bit 5 in LSR is set when the THRE is empty, and THRE is the input into the FIFO, so one would assume that when THRE is empty there could still be data in the FIFO, allowing it to be drip fed. Having status bits for both THRE empty and TSR empty (bit 6) in [B]the current implementation makes the FIFO practically useless, [/B]in my opinion. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bit 5 should have been implemented to signal when the FIFO is not full, not when the entire FIFO is empty ... when it's too late to do anything about it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Frank&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560104#M15710</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560105#M15711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Mon May 20 06:37:39 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I managed to get a fully working FIFO transmission routine running on the 1227 using my own counter. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I keep a software FIFO than feeds the hardware FIFO, the serial write func puts the byte into either the HW or SW FIFO depending on what is already in the HW FIFO. If there are no bytes in either it writes directly into THR.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It tested well for all speeds up to about 500kbps at which time there is hardly any time between interrupts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can post the code but it has a lot of dependences on various library routines and structures I have.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some details here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://ardweenet.blogspot.com.au/2012/12/nxp-wtf.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://ardweenet.blogspot.com.au/2012/12/nasty-nasty-atomic.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560105#M15711</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560106#M15712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ToBeFrank on Mon May 20 07:15:50 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: graynomad&lt;/STRONG&gt;&lt;BR /&gt;I managed to get a fully working FIFO transmission routine running on the 1227 using my own counter. &lt;BR /&gt;&lt;BR /&gt;I keep a software FIFO than feeds the hardware FIFO, the serial write func puts the byte into either the HW or SW FIFO depending on what is already in the HW FIFO. If there are no bytes in either it writes directly into THR&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's exactly how my implementation works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://ardweenet.blogspot.com.au/2012/12/nasty-nasty-atomic.html&lt;/A&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;I left a comment for you on this one. :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560106#M15712</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560107#M15713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Mon May 20 07:44:31 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok thanks for that snippet, that's what you do on AVRs but I didn't realise the ARM had an equivalent register.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560107#M15713</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560108#M15714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by AchimKraus on Wed Apr 23 08:42:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Very good thread!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was already starting to get crazy about the tx fifo und the THRE flag ('550 compatible, sure?) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Very bad, that the bug didn't make it to the erratas ... or did I miss it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the workaround is still missing in openLPC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560108#M15714</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560109#M15715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ant_ on Wed Dec 03 10:17:03 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Someone might find this idea of use. It's no help for heavy traffic but if you have less than a fifo size of data to send and it's normally sent before the next burst, it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
static char FifoContains = 0;
void Uart0WriteByte(const char ch)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (FifoContains &amp;lt; 16)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART0-&amp;gt;THR = ch;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FifoContains++;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((LPC_UART0-&amp;gt;LSR &amp;amp; LSR_THRE) == 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART0-&amp;gt;THR = ch;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FifoContains&amp;nbsp;&amp;nbsp; = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&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 22:16:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560109#M15715</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560110#M15716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by gbiagioni on Wed Mar 16 09:10:33 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this is an old thread but five years later I find that every example from NXP is still incorrect. I have spent a lot of wasted time on this issue and hope the following code from my interrupt handler can save some others the same plight. An interrupt handler based on this strategy will correctly flow data out of the UART 16 bytes per interrupt:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (uartReg.LSR &amp;amp; UART_LSR_THRE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { // the THR FIFO is empty, so send up to 16 bytes to UART from Tx buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amt = amt&amp;gt;16 ? 16 : amt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // FIFO limit is 16&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while&amp;nbsp; (amt&amp;gt;0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { // put a byte into Tx FIFO&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uartReg.THR = *buf++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amt--;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The FIFO will not overflow because a zero UART_LSR_THRE bit means the FIFO is empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem here is the examples provided by NXP, not the design of the UART nor the documentation (which correctly defines UART_LSR_THRE behaviour). Once understood, the design is actually rather nice for an interrupt driven scenario. Maybe not so nice in a polled environment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:16:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560110#M15716</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: can't get uart tx fifo to work</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560111#M15717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is my implementation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/* Transmit a byte array through the UART peripheral (non-blocking) */&lt;BR /&gt;int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)&lt;BR /&gt;{&lt;BR /&gt; int sent = 0;&lt;BR /&gt; uint8_t *p8 = (uint8_t *) data;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* beforehand, wait till the buffer is empty*/&lt;BR /&gt; while ((Chip_UART_ReadLineStatus(pUART) &amp;amp; UART_LSR_THRE) == 0)&lt;BR /&gt; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*send 16 bytes to bufferred Tx*/&lt;BR /&gt; while (sent &amp;lt; numBytes) {&lt;BR /&gt; Chip_UART_SendByte(pUART, *p8);&lt;BR /&gt; p8++;&lt;BR /&gt; sent++;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /*Wait till buffer is empty every 16 Bytes*/&lt;BR /&gt; if(!(sent % 16))&lt;BR /&gt; {&lt;BR /&gt; while ((Chip_UART_ReadLineStatus(pUART) &amp;amp; UART_LSR_THRE) == 0)&lt;BR /&gt; ;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; }&lt;BR /&gt; return sent;&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2017 17:02:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/can-t-get-uart-tx-fifo-to-work/m-p/560111#M15717</guid>
      <dc:creator>tobiasfrauenrat</dc:creator>
      <dc:date>2017-02-03T17:02:15Z</dc:date>
    </item>
  </channel>
</rss>

