<?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>Kinetis MicrocontrollersのトピックMKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959833#M54995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="" style="color: #333333; background-color: #ffffff; border: 0px; margin: 6px 0px 0px;"&gt;MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05]&lt;/P&gt;&lt;P class="" style="color: #333333; background-color: #ffffff; border: 0px; margin: 6px 0px 0px;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;Device:&lt;/SPAN&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: 600;"&gt;MKL26Z256xxx4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #333333; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;SDK_2.x_MKL26Z256xxx4&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: 600;"&gt;2.4.1&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="" style="color: #333333; background-color: #ffffff; border: 0px; padding: 4px 0px 0px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;I started with the interrupt_rb_transfer project.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;My custom board has a&amp;nbsp;MKL26Z256 that is connected to a modem at 115200.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Using a Logic Analyzer, I can see my TX strings ("AT\n") getting to a modem, and I see the RX strings being returned ("OK\r\n").&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The UART_UserCallback() is being called when the TX is idle:&amp;nbsp;kStatus_UART_TxIdle&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But &lt;SPAN&gt;UART_UserCallback() is&lt;/SPAN&gt;&amp;nbsp;not getting called when the RX is idle:&amp;nbsp;kStatus_UART_RxIdle&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Since the&amp;nbsp;kStatus_UART_RxIdle event does not occur, the&amp;nbsp;&lt;SPAN&gt;UART_UserCallback() is being called&amp;nbsp;with the events:&amp;nbsp;kStatus_UART_RxRingBufferOverrun and then&amp;nbsp;kStatus_UART_RxHardwareOverrun.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;I have not modified the code that sets up the UART, so I can't explain why I am not getting the expected &lt;SPAN style="background-color: #ffffff;"&gt;kStatus_UART_RxIdle&amp;nbsp;event&lt;/SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Can somebody suggest what might explain why the&amp;nbsp;&lt;SPAN&gt;kStatus_UART_RxIdle&amp;nbsp;event is not occurring?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Thanks,&lt;/P&gt;&lt;DIV class="" style="color: #333333; background-color: #ffffff; border: 0px; padding: 4px 0px 0px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Bruce Graham&lt;BR /&gt;Senior Software Engineer&lt;BR /&gt;TechnoSoft Innovations, Inc.&lt;BR /&gt;bgraham@technosofteng.com&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jul 2019 21:03:45 GMT</pubDate>
    <dc:creator>bgraham</dc:creator>
    <dc:date>2019-07-23T21:03:45Z</dc:date>
    <item>
      <title>MKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959833#M54995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="" style="color: #333333; background-color: #ffffff; border: 0px; margin: 6px 0px 0px;"&gt;MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05]&lt;/P&gt;&lt;P class="" style="color: #333333; background-color: #ffffff; border: 0px; margin: 6px 0px 0px;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;Device:&lt;/SPAN&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: 600;"&gt;MKL26Z256xxx4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #333333; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;SDK_2.x_MKL26Z256xxx4&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="border: 0px; font-weight: 600;"&gt;2.4.1&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="" style="color: #333333; background-color: #ffffff; border: 0px; padding: 4px 0px 0px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;I started with the interrupt_rb_transfer project.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;My custom board has a&amp;nbsp;MKL26Z256 that is connected to a modem at 115200.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Using a Logic Analyzer, I can see my TX strings ("AT\n") getting to a modem, and I see the RX strings being returned ("OK\r\n").&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The UART_UserCallback() is being called when the TX is idle:&amp;nbsp;kStatus_UART_TxIdle&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;But &lt;SPAN&gt;UART_UserCallback() is&lt;/SPAN&gt;&amp;nbsp;not getting called when the RX is idle:&amp;nbsp;kStatus_UART_RxIdle&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Since the&amp;nbsp;kStatus_UART_RxIdle event does not occur, the&amp;nbsp;&lt;SPAN&gt;UART_UserCallback() is being called&amp;nbsp;with the events:&amp;nbsp;kStatus_UART_RxRingBufferOverrun and then&amp;nbsp;kStatus_UART_RxHardwareOverrun.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;I have not modified the code that sets up the UART, so I can't explain why I am not getting the expected &lt;SPAN style="background-color: #ffffff;"&gt;kStatus_UART_RxIdle&amp;nbsp;event&lt;/SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Can somebody suggest what might explain why the&amp;nbsp;&lt;SPAN&gt;kStatus_UART_RxIdle&amp;nbsp;event is not occurring?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Thanks,&lt;/P&gt;&lt;DIV class="" style="color: #333333; background-color: #ffffff; border: 0px; padding: 4px 0px 0px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Bruce Graham&lt;BR /&gt;Senior Software Engineer&lt;BR /&gt;TechnoSoft Innovations, Inc.&lt;BR /&gt;bgraham@technosofteng.com&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:03:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959833#M54995</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-07-23T21:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959834#M54996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more detail.&lt;/P&gt;&lt;P&gt;When the&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;kStatus_UART_RxRingBufferOverrun&lt;SPAN&gt;&amp;nbsp; event occurs, I call&amp;nbsp;UART_TransferReceiveNonBlocking() and get all of the RX chars that the modem sent to the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;MKL26Z256.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;So, the UART is working, expect that the&amp;nbsp;kStatus_UART_RxIdle event is not being sent by the fsl_uart.c code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;I need the uart driver to send the kStatus_UART_RxIdle event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;What would cause the uart driver to fail to send&amp;nbsp;the&amp;nbsp;kStatus_UART_RxIdle event?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Bruce&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:34:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959834#M54996</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-07-23T21:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959835#M54997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;Bruce&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Please check the Idle Line Type UARTx_C1[ILT] and UARTx_C2[ILIE].&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="UARTx_C1[ILT].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/82493iB3B2084D84252A31/image-size/large?v=v2&amp;amp;px=999" role="button" title="UARTx_C1[ILT].png" alt="UARTx_C1[ILT].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="UARTx_C2[ILIE].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/82539i10EFEE4415DFBDE7/image-size/large?v=v2&amp;amp;px=999" role="button" title="UARTx_C2[ILIE].png" alt="UARTx_C2[ILIE].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am not sure if you enable the kUART_IdleLineInterruptEnable?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="UART_EnableInterrupts kUART_IdleLineInterruptEnable.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/82695iC460155CF0776C91/image-size/large?v=v2&amp;amp;px=999" role="button" title="UART_EnableInterrupts kUART_IdleLineInterruptEnable.png" alt="UART_EnableInterrupts kUART_IdleLineInterruptEnable.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The IDLE status flag includes logic that prevents it from getting set repeatedly when the RxD line remains idle for an extended period of time. IDLE is cleared by reading UART_S1 while UART_S1[IDLE] is set and then reading UART_D. After UART_S1[IDLE] has been cleared, it cannot become set again until the receiver has received at least one new character and has set UART_S1[RDRF].&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="UARTx_S1[IDLE].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/82575i28CFA8911DDB6885/image-size/large?v=v2&amp;amp;px=999" role="button" title="UARTx_S1[IDLE].png" alt="UARTx_S1[IDLE].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&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>Wed, 24 Jul 2019 09:11:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959835#M54997</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-07-24T09:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959836#M54998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added the line&amp;nbsp;UART_EnableInterrupts(DEMO_UART, kUART_IdleLineInterruptEnable); before the call to&amp;nbsp;UART_TransferStartRingBuffer().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After UART_UserCallback()&amp;nbsp;kStatus_UART_RxHardwareOverrun, I checked the registers.&lt;/P&gt;&lt;P&gt;UART1 C2.ILIE is 1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;UART1 S1.IDLE is 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See registers below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/82497i25EC051D39E12F44/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since C2.&lt;SPAN&gt;ILIE is set, why would&amp;nbsp;&lt;/SPAN&gt;UART_UserCallback() never got called with&amp;nbsp;kStatus_UART_RxIdle?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bruce&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// File:&amp;nbsp;uart_interrupt_rb_transfer.c&lt;/P&gt;&lt;P&gt;#include "board.h"&lt;BR /&gt;#include "fsl_uart.h"&lt;/P&gt;&lt;P&gt;#include "pin_mux.h"&lt;BR /&gt;#include "clock_config.h"&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;ctype.h&amp;gt;&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Definitions&lt;BR /&gt; ******************************************************************************/&lt;BR /&gt;/* UART instance and clock */&lt;BR /&gt;#define DEMO_UART UART1&lt;BR /&gt;#define DEMO_UART_CLKSRC BUS_CLK&lt;BR /&gt;#define DEMO_UART_CLK_FREQ CLOCK_GetFreq(BUS_CLK)&lt;/P&gt;&lt;P&gt;#define RX_RING_BUFFER_SIZE 20U&lt;BR /&gt;#define ECHO_BUFFER_SIZE 8U&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Prototypes&lt;BR /&gt; ******************************************************************************/&lt;/P&gt;&lt;P&gt;/* UART user callback */&lt;BR /&gt;void UART_UserCallback(UART_Type *base, uart_handle_t *handle, status_t status, void *userData);&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Variables&lt;BR /&gt; ******************************************************************************/&lt;BR /&gt;uart_handle_t g_uartHandle;&lt;/P&gt;&lt;P&gt;uint8_t g_rxRingBuffer[RX_RING_BUFFER_SIZE] = {0}; /* RX ring buffer. */&lt;/P&gt;&lt;P&gt;uint8_t g_rxBuffer[ECHO_BUFFER_SIZE] = {0};&lt;BR /&gt;uint8_t g_txBuffer[] = "ATE0\n";&lt;/P&gt;&lt;P&gt;volatile bool bProcessRx = false;&lt;BR /&gt;volatile bool bGotTxIdle = false;&lt;BR /&gt;volatile bool bRxMessageReceived = false;&lt;/P&gt;&lt;P&gt;char szDummyObj[] = "Hello";&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;BR /&gt; * Code&lt;BR /&gt; ******************************************************************************/&lt;BR /&gt;/* UART user callback */&lt;BR /&gt;void UART_UserCallback(UART_Type *base, uart_handle_t *handle, status_t status, void *userData)&lt;BR /&gt;{&lt;BR /&gt; assert(0 == strcmp(szDummyObj, (char*) userData));&lt;/P&gt;&lt;P&gt;switch(status)&lt;BR /&gt; {&lt;BR /&gt; case kStatus_UART_TxIdle:&lt;BR /&gt; printf("\r\nISR: Tx Idle\r\n");&lt;BR /&gt; bGotTxIdle = true;&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;case kStatus_UART_RxIdle:&lt;BR /&gt; printf("\r\nISR: Rx Idle\r\n");&lt;BR /&gt; bProcessRx = true;&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;case kStatus_UART_RxRingBufferOverrun:&lt;BR /&gt; printf("\r\nISR: Rx Ring Buffer Overrun\r\n");&lt;BR /&gt; bProcessRx = true;&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;case kStatus_UART_RxHardwareOverrun:&lt;BR /&gt; printf("\r\nISR: Rx Hardware Overrun\r\n");&lt;BR /&gt; bProcessRx = true;&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;case kStatus_UART_NoiseError:&lt;BR /&gt; printf("\r\nISR: Noise Error\r\n");&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;case kStatus_UART_FramingError:&lt;BR /&gt; printf("\r\nISR: Framing Error\r\n");&lt;BR /&gt; bProcessRx = true;&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;default:&lt;BR /&gt; printf("\r\nISR: status: %d\r\n", status);&lt;BR /&gt; break;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (bProcessRx)&lt;BR /&gt; {&lt;BR /&gt; bProcessRx = false;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// output&lt;BR /&gt;#define BOARD_CELL_PWRKEY_GPIO GPIOE // PTE20&lt;BR /&gt;#define BOARD_CELL_PWRKEY_PORT PORTE&lt;BR /&gt;#define BOARD_CELL_PWRKEY_GPIO_PIN 20U&lt;/P&gt;&lt;P&gt;void delay(int iMillisec)&lt;BR /&gt;{&lt;BR /&gt; int iLoops = iMillisec * 4400;&lt;/P&gt;&lt;P&gt;//printf("delay(%d)\r\n", iMillisec);&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; iLoops; ++i)&lt;BR /&gt; {&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * Purpose: Cycling PWRKEY will turn the modem on or off.&lt;BR /&gt; */&lt;BR /&gt;void cycleModemPWRKEY(void)&lt;BR /&gt;{&lt;BR /&gt; // modem did not respond, so wake it up&lt;BR /&gt; printf("\tEC21 Pulse PWRKEY low for at least 500ms\r\n");&lt;BR /&gt; printf("\tEC21 PWRKEY - High\r\n");&lt;BR /&gt; GPIO_WritePinOutput(BOARD_CELL_PWRKEY_GPIO, BOARD_CELL_PWRKEY_GPIO_PIN, 1);&lt;BR /&gt; printf("\tEC21 Delay 100 ms\r\n");&lt;BR /&gt; delay(100);&lt;BR /&gt; printf("\tEC21 PWRKEY - Low\r\n");&lt;BR /&gt; GPIO_WritePinOutput(BOARD_CELL_PWRKEY_GPIO, BOARD_CELL_PWRKEY_GPIO_PIN, 0);&lt;BR /&gt; printf("\tEC21 Delay 800 ms - minimum pulse width is 500ms\r\n");&lt;BR /&gt; delay(800);&lt;BR /&gt; printf("\tEC21 PWRKEY - High\r\n");&lt;BR /&gt; GPIO_WritePinOutput(BOARD_CELL_PWRKEY_GPIO, BOARD_CELL_PWRKEY_GPIO_PIN, 1);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*!&lt;BR /&gt; * @brief Main function&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; uart_config_t config;&lt;BR /&gt; uart_transfer_t sendXfer;&lt;/P&gt;&lt;P&gt;printf("starting\r\n");&lt;/P&gt;&lt;P&gt;BOARD_InitPins();&lt;BR /&gt; BOARD_BootClockRUN();&lt;/P&gt;&lt;P&gt;cycleModemPWRKEY();&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * config.baudRate_Bps = 115200U;&lt;BR /&gt; * config.parityMode = kUART_ParityDisabled;&lt;BR /&gt; * config.stopBitCount = kUART_OneStopBit;&lt;BR /&gt; * config.txFifoWatermark = 0;&lt;BR /&gt; * config.rxFifoWatermark = 1;&lt;BR /&gt; * config.enableTx = false;&lt;BR /&gt; * config.enableRx = false;&lt;BR /&gt; */&lt;BR /&gt; UART_GetDefaultConfig(&amp;amp;config);&lt;BR /&gt; config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;&lt;BR /&gt; config.enableTx = true;&lt;BR /&gt; config.enableRx = true;&lt;/P&gt;&lt;P&gt;UART_Init(DEMO_UART, &amp;amp;config, DEMO_UART_CLK_FREQ);&lt;BR /&gt; UART_TransferCreateHandle(DEMO_UART, &amp;amp;g_uartHandle, UART_UserCallback, szDummyObj);&lt;BR /&gt; UART_EnableInterrupts(DEMO_UART, kUART_IdleLineInterruptEnable); // ADDED PER NXP COMMUNITY SUGGESTION&lt;BR /&gt; UART_TransferStartRingBuffer(DEMO_UART, &amp;amp;g_uartHandle, g_rxRingBuffer, RX_RING_BUFFER_SIZE);&lt;/P&gt;&lt;P&gt;sendXfer.data = g_txBuffer;&lt;BR /&gt; sendXfer.dataSize = strlen((char*)g_txBuffer);&lt;/P&gt;&lt;P&gt;// call to UART_TransferReceiveNonBlocking() enables kStatus_UART_RxIdle event&lt;BR /&gt; char szRxTemp[100] = {0};&lt;BR /&gt; int iCount = 0;&lt;/P&gt;&lt;P&gt;char szLastMessage[100];&lt;/P&gt;&lt;P&gt;size_t receivedCount;&lt;BR /&gt; uart_transfer_t receiveXfer;&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt; {&lt;BR /&gt; printf("UART_TransferReceiveNonBlocking()\r\n");&lt;/P&gt;&lt;P&gt;bRxMessageReceived = false;&lt;BR /&gt; receiveXfer.data = (uint8_t*)szRxTemp;&lt;BR /&gt; receiveXfer.dataSize = sizeof(szRxTemp);&lt;BR /&gt; do&lt;BR /&gt; {&lt;BR /&gt; UART_TransferReceiveNonBlocking(DEMO_UART, &amp;amp;g_uartHandle, &amp;amp;receiveXfer, &amp;amp;receivedCount);&lt;BR /&gt; if (receivedCount)&lt;BR /&gt; {&lt;BR /&gt; // done when \n (end of string) is received&lt;BR /&gt; if (NULL != strstr(szRxTemp, "\n"))&lt;BR /&gt; {&lt;BR /&gt; strcpy(szLastMessage, szRxTemp);&lt;BR /&gt; bRxMessageReceived = true;&lt;/P&gt;&lt;P&gt;memset(szRxTemp, 0, sizeof(szRxTemp));&lt;BR /&gt; iCount = 0;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; iCount += receivedCount;&lt;BR /&gt; assert(iCount &amp;lt; sizeof(szRxTemp));&lt;BR /&gt; receiveXfer.data = (uint8_t*)&amp;amp;szRxTemp[iCount];&lt;BR /&gt; receiveXfer.dataSize = sizeof(szRxTemp) - iCount;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } while (!bRxMessageReceived);&lt;/P&gt;&lt;P&gt;// print to debug console, with hex for not printable chars&lt;BR /&gt; char szTemp[100] = {0};&lt;/P&gt;&lt;P&gt;for(int i = 0; i &amp;lt; strlen(szLastMessage); ++i)&lt;BR /&gt; {&lt;BR /&gt; int iLength = strlen(szTemp);&lt;/P&gt;&lt;P&gt;if (isprint(szLastMessage[i]))&lt;BR /&gt; sprintf(&amp;amp;szTemp[iLength], "%c", szLastMessage[i]);&lt;BR /&gt; else&lt;BR /&gt; sprintf(&amp;amp;szTemp[iLength], "&amp;lt;0x%02X&amp;gt;", szLastMessage[i]);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;printf("LastMessage: %s\r\n", szTemp);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt; {&lt;BR /&gt; while(!bRxMessageReceived)&lt;BR /&gt; {&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("TX: %s", g_txBuffer);&lt;BR /&gt; bGotTxIdle = false;&lt;BR /&gt; UART_TransferSendNonBlocking(DEMO_UART, &amp;amp;g_uartHandle, &amp;amp;sendXfer);&lt;BR /&gt; while (!bGotTxIdle)&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt; printf("\r\n");&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:45:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959836#M54998</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-07-24T16:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z256 UART RX callback get ring buffer overflow, but not RX idle</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959837#M54999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I started this time with the freertos_uart example.&lt;/P&gt;&lt;P&gt;I modified the callback events. I used a seperate event for RX and TX Complete.&lt;/P&gt;&lt;P&gt;I used 2 separate events so that my RX and TX threads can wait for their own event.&lt;/P&gt;&lt;P&gt;I needed an independent RX thread so that it can parse modem status messages that the modem sends without a command being sent to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The TX thread is working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The RX thread has the same problem I ran into with the preveous app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the modem sends the string "\r\nRDY\r\n" to the NXP,&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;UART_TransferReceiveNonBlocking():&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;gets the first char '\r',&lt;/P&gt;&lt;P&gt;gets a&amp;nbsp;kStatus_UART_RxHardwareOverrun, and misses the second char '\n',&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;gets the third char 'R',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;then gets&amp;nbsp;&lt;SPAN&gt;kStatus_UART_RxHardwareOverrun forever.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The ring buffer is set up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The UART's&amp;nbsp;C2 is TIE:0 TCIE:0 RIE:1 ILIE:1 TE:1 RE:1 RWU:0 SBK:0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The callback only sets an event.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;With the core running at 48 MHz, setting an event can't be taking so long that the UART RX hardware over runs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only way I can explain this is that the fsl_uart.c code is somehow halting&amp;nbsp;the UART RX.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I put&amp;nbsp;assert(UART1-&amp;gt;C2 &amp;amp;&amp;amp; UART_C2_ILIE_MASK) before the call to&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;UART_TransferReceiveNonBlocking(), so the IDLE interrupt is OK.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, what else could cause this loss of RX chars, and the RX overrun?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bruce&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2019 19:53:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKL26Z256-UART-RX-callback-get-ring-buffer-overflow-but-not-RX/m-p/959837#M54999</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-07-25T19:53:02Z</dc:date>
    </item>
  </channel>
</rss>

