<?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>LPC MicrocontrollersのトピックUART used on for full duplex RS422 : RX bytes lost when flushing TX FIFO</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/UART-used-on-for-full-duplex-RS422-RX-bytes-lost-when-flushing/m-p/522249#M4885</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by renonbenoit on Mon Mar 16 09:07:24 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using the UART0 peripheral of the LPC1768 for a full duplex communication on a RS422 physical link between a ECU (embedding LPC1768) and a PC (classical COM port terminal). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both ECU and PC transmit 300-bytes-long frames periodically at 100ms (multi-master / full-duplex communication). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that we are loosing bytes on the ECU side, i.e. the LPC1768 RX FIFO is loosing bytes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This problems occurs almost every hour. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We developped a software driver for UART which uses interrupts both for RX and TX events : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RX FIFO trigger level is set to 0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RDA interrupts are handled as well as CTI interrupts to build-up our RX SW buffer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RLS interrupts are handled to notify errors &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- THRE interrupts are handled to fill the TX FIFO as fast as possible &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the driver systematically flushes out the TX FIFO of the UART (using bit 2 of FCR register) before sending a new frame &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We instrumented our code and spent hours debugging our driver to finally conclude that the LPC1768 may not handle correctly simultaneous TX and RX FIFO activities. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a summary of our obsevations :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Removing the code that flushes TX FIFO before each transmission seems to solve the problem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Number of lost bytes is very often (75%) 13 bytes. We guess there is something around CTI handling because this kind of event is supposed to occur when a byte is in the RX FIFO since more than 3.5 character-times, and the RX FIFO is 16 bytes long.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you already some customer feedback about such things ? Is there a known bug in UART module that does not appear in errata sheets ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for your help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Benoit&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:53:52 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:53:52Z</dc:date>
    <item>
      <title>UART used on for full duplex RS422 : RX bytes lost when flushing TX FIFO</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UART-used-on-for-full-duplex-RS422-RX-bytes-lost-when-flushing/m-p/522249#M4885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by renonbenoit on Mon Mar 16 09:07:24 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using the UART0 peripheral of the LPC1768 for a full duplex communication on a RS422 physical link between a ECU (embedding LPC1768) and a PC (classical COM port terminal). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both ECU and PC transmit 300-bytes-long frames periodically at 100ms (multi-master / full-duplex communication). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that we are loosing bytes on the ECU side, i.e. the LPC1768 RX FIFO is loosing bytes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This problems occurs almost every hour. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We developped a software driver for UART which uses interrupts both for RX and TX events : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RX FIFO trigger level is set to 0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RDA interrupts are handled as well as CTI interrupts to build-up our RX SW buffer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- RLS interrupts are handled to notify errors &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- THRE interrupts are handled to fill the TX FIFO as fast as possible &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the driver systematically flushes out the TX FIFO of the UART (using bit 2 of FCR register) before sending a new frame &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We instrumented our code and spent hours debugging our driver to finally conclude that the LPC1768 may not handle correctly simultaneous TX and RX FIFO activities. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a summary of our obsevations :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Removing the code that flushes TX FIFO before each transmission seems to solve the problem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Number of lost bytes is very often (75%) 13 bytes. We guess there is something around CTI handling because this kind of event is supposed to occur when a byte is in the RX FIFO since more than 3.5 character-times, and the RX FIFO is 16 bytes long.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you already some customer feedback about such things ? Is there a known bug in UART module that does not appear in errata sheets ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for your help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Benoit&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UART-used-on-for-full-duplex-RS422-RX-bytes-lost-when-flushing/m-p/522249#M4885</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:52Z</dc:date>
    </item>
  </channel>
</rss>

