<?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: Why am I unable to clear UART overrun/framing error? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701549#M43136</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I have found what causes the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the same problem with Kinetis KEA64 MCU - once overrun flag occurs, interrupts stop and OR flag cannot be cleared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found out, that in order to clear OR flag&amp;nbsp;OR interrupt itself must be enabled. Is is possibly connected together in a way that&amp;nbsp;if interrupt is not enabled, then the flag is untouchable. Once I enabled overrun interrupt in C3 register (in my case), I was able to clear overrun flag and interrupts continued to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After my discovery, I read the datasheet again, and found out, that I was probably misinterpreting the below line&amp;nbsp;provided in the datasheet:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;To clear OR, read UART_S1 with OR set and then read the UART data register (UART_D).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Before the discovery I thought, that in order to clear OR it should be set in S1 (obviously), but now I started to think that author of the datasheet maybe meant that OR interrupt must be set in order to be able to clear the OR flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this is the case for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Sep 2018 09:43:58 GMT</pubDate>
    <dc:creator>mariusb</dc:creator>
    <dc:date>2018-09-18T09:43:58Z</dc:date>
    <item>
      <title>Why am I unable to clear UART overrun/framing error?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701546#M43133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm unable to clear UART framing/overrun errors following the recommended procedure:&lt;/P&gt;&lt;P&gt;-disable RX&lt;/P&gt;&lt;P&gt;-read S1&lt;/P&gt;&lt;P&gt;-read D&lt;/P&gt;&lt;P&gt;-enable RX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like this person was having the same issue, not sure if it was ever resolved:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/312294"&gt;Kinetis K10 UART overrun error.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a K22f, the UART in question is UART5.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two questions:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Why isn't the above procedure clearing the overrun error?&lt;/P&gt;&lt;P&gt;2) What dictates whether the device transitions to&amp;nbsp;PE_ISR(Cpu_ivINT_UART5_ERR) after encountering an error?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main concern is preventing my code from hanging when it hits a UART error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 22:45:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701546#M43133</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-09-12T22:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to clear UART overrun/framing error?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701547#M43134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexander&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used this code in the uTasker project for several years on various parts in order to recover from overruns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (((UART5_S1 &amp;amp; UART_S1_RDRF) &amp;amp; UART5_C2) != 0) {&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; // reception interrupt flag is set and the reception interrupt is enabled&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fnUART5_HANDLER((unsigned char)UART5_D);&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; // receive data interrupt - read the byte&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((UART5_S1 &amp;amp; UART_S1_OR) != 0) {&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; // check status here to ensure that an overrun taking place between reading the status register on entry to the interrupt and reading the data register is detected&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&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; (void)UART5_D;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; // read the data register in order to clear the overrun flag and allow the receiver to continue operating&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since there will always be a receive interrupt to handle I never found it useful to install a dedicated interrupt for this error source. Practically it was never fund necessary to disable the receiver.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 23:27:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701547#M43134</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2017-09-12T23:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to clear UART overrun/framing error?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701548#M43135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd like to bump this question. Mark - thanks for the reply. Your procedure seems to essentially the same as what I'm doing, but still the UART overruns are causing the UART to eventually stop receiving RX interrupts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what I'm seeing:&lt;/P&gt;&lt;P&gt;1) UART RX is working&lt;/P&gt;&lt;P&gt;2) Eventual buffer overrun or framing error&lt;/P&gt;&lt;P&gt;3)&amp;nbsp;UART5_OnError function is hit.&amp;nbsp;UART5_OnError clears error flags.&lt;/P&gt;&lt;P&gt;4)&amp;nbsp;PE_ISR(Cpu_ivINT_UART5_ERR) is hit. I've commented out&amp;nbsp;PE_DEBUGHALT() and replaced with a printf call.&lt;/P&gt;&lt;P&gt;5) Soon after,&amp;nbsp;&lt;SPAN&gt;PE_ISR(Cpu_ivINT_UART5_ERR) is hit without&amp;nbsp;UART5_OnError&amp;nbsp;being executed. (Why is the PE_ISR triggered twice, while&amp;nbsp;UART5_OnError&amp;nbsp; is only triggered once?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;6) UART5 fails to receive any incoming bytes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Why is this happening? I am:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;a) clearing error flags in the interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b) flushing buffer in the interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;c) flushing before before and after any large transfers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I don't see how the UART is getting into what looks like a permanent RX buffer overrun state. Even if it temporarily overruns, it should eventually flush and start up again.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Would appreciate some support from NXP on this one. Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2017 00:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701548#M43135</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-10-27T00:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to clear UART overrun/framing error?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701549#M43136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I have found what causes the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the same problem with Kinetis KEA64 MCU - once overrun flag occurs, interrupts stop and OR flag cannot be cleared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found out, that in order to clear OR flag&amp;nbsp;OR interrupt itself must be enabled. Is is possibly connected together in a way that&amp;nbsp;if interrupt is not enabled, then the flag is untouchable. Once I enabled overrun interrupt in C3 register (in my case), I was able to clear overrun flag and interrupts continued to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After my discovery, I read the datasheet again, and found out, that I was probably misinterpreting the below line&amp;nbsp;provided in the datasheet:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;To clear OR, read UART_S1 with OR set and then read the UART data register (UART_D).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Before the discovery I thought, that in order to clear OR it should be set in S1 (obviously), but now I started to think that author of the datasheet maybe meant that OR interrupt must be set in order to be able to clear the OR flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this is the case for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 09:43:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701549#M43136</guid>
      <dc:creator>mariusb</dc:creator>
      <dc:date>2018-09-18T09:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to clear UART overrun/framing error?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701550#M43137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very interesting. I will test this possibility when I get a chance. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 00:06:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-am-I-unable-to-clear-UART-overrun-framing-error/m-p/701550#M43137</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2018-10-24T00:06:07Z</dc:date>
    </item>
  </channel>
</rss>

