<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックLinux UART driver for 5475 loses data</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186400#M7844</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the Linux 2.6.10 kernel and finding that the UART driver seems to lose data whenever the receive buffer (flip buffer) is full. The interrupt routine receive_chars() in drivers/serial/mcfserial.c had the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;static _INLINE_ void receive_chars(struct mcf_serial *info,
&amp;nbsp; volatile unsigned char *uartp)
{
&amp;nbsp; struct tty_struct *tty = info-&amp;gt;tty;
&amp;nbsp; unsigned char&amp;nbsp; status, ch;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; if (!tty)
 return;

&amp;nbsp; while ((status = uartp[MCFUART_USR]) &amp;amp; MCFUART_USR_RXREADY) {
 if (tty-&amp;gt;flip.count &amp;gt;= TTY_FLIPBUF_SIZE) {
&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp; * can't take any more data.&amp;nbsp; Turn off receiver
&amp;nbsp;&amp;nbsp; * so that the interrupt doesn't continually
&amp;nbsp;&amp;nbsp; * occur.
&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp; info-&amp;gt;imr &amp;amp;= ~MCFUART_UIR_RXREADY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uartp[MCFUART_UIMR] = info-&amp;gt;imr;
&amp;nbsp; break;
&amp;nbsp; }
 ....&amp;nbsp; //process the character
&amp;nbsp; }
&amp;nbsp; schedule_delayed_work(&amp;amp;tty-&amp;gt;flip.work, 1);
&amp;nbsp; return;
}
&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;what I found is that the interrupts never get activated again so I changed it to:&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;if (tty-&amp;gt;flip.count &amp;gt;= TTY_FLIPBUF_SIZE) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;When the interrupt completes it schedules the flipping of of the buffers&amp;nbsp; but&amp;nbsp; somehow even if I have RTS/CTS I still lose data.&lt;BR /&gt;I even&amp;nbsp; tried enabling low_latency for the driver and scheduling the work of flipping the buffers immediately using (at the end of the receive_chars() routine) :&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;schedule_work(&amp;amp;tty-&amp;gt;flip.work);&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;I have the following questions:&lt;BR /&gt;1. If the data is not read from the FIFO queue in the interrupt routine does it discard those characters?&lt;BR /&gt;2. Where would the interrupt be enabled again when the it is disabled in the interrupt handler?&lt;BR /&gt;3. Is there another suggestions of how to solve it?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:37:26 GMT</pubDate>
    <dc:creator>jurgen</dc:creator>
    <dc:date>2020-10-29T09:37:26Z</dc:date>
    <item>
      <title>Linux UART driver for 5475 loses data</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186400#M7844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the Linux 2.6.10 kernel and finding that the UART driver seems to lose data whenever the receive buffer (flip buffer) is full. The interrupt routine receive_chars() in drivers/serial/mcfserial.c had the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;static _INLINE_ void receive_chars(struct mcf_serial *info,
&amp;nbsp; volatile unsigned char *uartp)
{
&amp;nbsp; struct tty_struct *tty = info-&amp;gt;tty;
&amp;nbsp; unsigned char&amp;nbsp; status, ch;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; if (!tty)
 return;

&amp;nbsp; while ((status = uartp[MCFUART_USR]) &amp;amp; MCFUART_USR_RXREADY) {
 if (tty-&amp;gt;flip.count &amp;gt;= TTY_FLIPBUF_SIZE) {
&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp; * can't take any more data.&amp;nbsp; Turn off receiver
&amp;nbsp;&amp;nbsp; * so that the interrupt doesn't continually
&amp;nbsp;&amp;nbsp; * occur.
&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp; info-&amp;gt;imr &amp;amp;= ~MCFUART_UIR_RXREADY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uartp[MCFUART_UIMR] = info-&amp;gt;imr;
&amp;nbsp; break;
&amp;nbsp; }
 ....&amp;nbsp; //process the character
&amp;nbsp; }
&amp;nbsp; schedule_delayed_work(&amp;amp;tty-&amp;gt;flip.work, 1);
&amp;nbsp; return;
}
&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;what I found is that the interrupts never get activated again so I changed it to:&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;if (tty-&amp;gt;flip.count &amp;gt;= TTY_FLIPBUF_SIZE) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;When the interrupt completes it schedules the flipping of of the buffers&amp;nbsp; but&amp;nbsp; somehow even if I have RTS/CTS I still lose data.&lt;BR /&gt;I even&amp;nbsp; tried enabling low_latency for the driver and scheduling the work of flipping the buffers immediately using (at the end of the receive_chars() routine) :&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;schedule_work(&amp;amp;tty-&amp;gt;flip.work);&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;I have the following questions:&lt;BR /&gt;1. If the data is not read from the FIFO queue in the interrupt routine does it discard those characters?&lt;BR /&gt;2. Where would the interrupt be enabled again when the it is disabled in the interrupt handler?&lt;BR /&gt;3. Is there another suggestions of how to solve it?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:37:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186400#M7844</guid>
      <dc:creator>jurgen</dc:creator>
      <dc:date>2020-10-29T09:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Linux UART driver for 5475 loses data</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186401#M7845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Jurgen,&lt;BR /&gt;&lt;BR /&gt;data will probably lost with an overrun error.&lt;BR /&gt;Interrupts could be reenabled by&lt;BR /&gt;- function that empties the flipbuffer&lt;BR /&gt;- timer event that checks if flipbuffer may take chars&lt;BR /&gt;Timer depends on your flipbuffer size and bitrate and will&lt;BR /&gt;probably be somewhere from 1ms to 10ms.&lt;BR /&gt;You might also have situations where the timer has to reenable&lt;BR /&gt;the tx int.&lt;BR /&gt;Regards, georg&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2008 22:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186401#M7845</guid>
      <dc:creator>taigbr</dc:creator>
      <dc:date>2008-09-17T22:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Linux UART driver for 5475 loses data</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186402#M7846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Georg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;thanks. You were on the right track. I am getting framing errors in one of my serial comms tests.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In my test I am sending at 115200 bps&amp;nbsp;(8N1) from the PC and only servicing the com port buffer at under 2400 Kbytes/s on the Coldfire.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why would I get framing errors?&lt;/DIV&gt;&lt;DIV&gt;When I am sending a 35K file&amp;nbsp;across I&amp;nbsp;only&amp;nbsp;receive about 24K on the Coldfire the rest is discarded because of framing errors. Could there be a timing problem?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am using&amp;nbsp;RTS/CTS which seems to be working as I can see the lines being asserted/unasserted and the PC is holding back when the FIFO buffer is full on the Coldfire.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;regards,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Jurgen&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2008 23:34:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186402#M7846</guid>
      <dc:creator>jurgen</dc:creator>
      <dc:date>2008-09-17T23:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Linux UART driver for 5475 loses data</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186403#M7847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Jurgen,&lt;BR /&gt;&lt;BR /&gt;framing error probably means that the bitrates don't fit. Maybe the uart divider&lt;BR /&gt;isn't set up correct or your system clock is not what you expect it to be.&lt;BR /&gt;It would also explain why you lose data. You could send some 0x55 chars&lt;BR /&gt;and have a look whith a scope to see your actual bitrate.&lt;BR /&gt;Regards, Georg&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 14:02:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186403#M7847</guid>
      <dc:creator>taigbr</dc:creator>
      <dc:date>2008-09-18T14:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Linux UART driver for 5475 loses data</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186404#M7848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Georg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I just wanted to let you know that&amp;nbsp;I sent an&amp;nbsp;invalid termio structure in my test app. to the uart which then gave me the framing errors. What gave rise to the tests was that I am losing LCP and check control packets that are sent from the&amp;nbsp;l2tp daemon to the VPN server which&amp;nbsp;then terminates my VPN session.&amp;nbsp;&amp;nbsp;I probably need to look at the networking layer to figure out why this is happening. Thanks for your help.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;regards,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Jurgen&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 18:41:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linux-UART-driver-for-5475-loses-data/m-p/186404#M7848</guid>
      <dc:creator>jurgen</dc:creator>
      <dc:date>2008-09-22T18:41:40Z</dc:date>
    </item>
  </channel>
</rss>

