<?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>i.MX ProcessorsのトピックRe: UART RX interrupt loop</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/UART-RX-interrupt-loop/m-p/1364628#M182431</link>
    <description>&lt;P&gt;I figured it out. See&amp;nbsp;&lt;A href="https://github.com/NXPmicro/mcux-sdk/pull/45" target="_blank"&gt;https://github.com/NXPmicro/mcux-sdk/pull/45&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Nov 2021 16:07:43 GMT</pubDate>
    <dc:creator>andyteufel</dc:creator>
    <dc:date>2021-11-01T16:07:43Z</dc:date>
    <item>
      <title>UART RX interrupt loop</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/UART-RX-interrupt-loop/m-p/1364587#M182422</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to get UART running with EDMA on an MIMXRT1010. The problem I have is that once a "Receive Data Register Full" interrupt is triggered, the interrupt "gets stuck" and the interrupt handler is executed in a loop, even though nothing is being received anymore. Clearing the interrupt and status flags does not help.&lt;/P&gt;&lt;P&gt;This is what my interrupt handler looks like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void LPUART1_IRQHandler(void) {
    log_info("IRQ: Status flags 0x%08X, FIFO flags 0x%08X", LPUART1-&amp;gt;STAT, LPUART1-&amp;gt;FIFO);
    if (LPUART_GetStatusFlags(LPUART1) &amp;amp; kLPUART_RxDataRegFullFlag) {
        uint8_t data = LPUART_ReadByte(LPUART1);
        log_info("UART RX: %02X", data);
    }
    NVIC_ClearPendingIRQ(LPUART1_IRQn); // This does not help
    SDK_ISR_EXIT_BARRIER;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;With that I get the following in the logs:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IRQ: Status flags 0x01E2C000, FIFO flags 0x00800099
UART RX: 00
IRQ: Status flags 0x01C2C000, FIFO flags 0x00C00099
IRQ: Status flags 0x01C2C000, FIFO flags 0x00C00099
... (continues)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is basically starving my application since the only thing that's running anymore is this interrupt handler. What am I doing wrong?&lt;/P&gt;&lt;P&gt;This is the UART initialization code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define BLUETOOTH_UART_RX_IOMUX             IOMUXC_GPIO_09_LPUART1_RXD
#define BLUETOOTH_UART_TX_IOMUX             IOMUXC_GPIO_10_LPUART1_TXD

#define BLUETOOTH_UART_PORT                 LPUART1
#define BLUETOOTH_UART_IRQn                 LPUART1_IRQn
#define BLUETOOTH_UART_BAUDRATE             115200u

#define LPUART_TX_DMA_CHANNEL               0u
#define LPUART_TX_DMA_REQUEST               kDmaRequestMuxLPUART1Tx
#define BT_LPUART_DMAMUX_BASEADDR           DMAMUX
#define BT_LPUART_DMA_BASEADDR              DMA0

void board_hal_uart_init(const board_hal_uart_config_t *p_config) {
    APP_ASSERT(p_config != NULL, "Invalid UART configuration");
    APP_ASSERT(p_config-&amp;gt;rx_isr_handler != NULL, "Invalid UART RX ISR handler");
    APP_ASSERT(p_config-&amp;gt;tx_done_callback != NULL, "Invalid UART TX done callback");
    m_bluetooth_uart.p_config = p_config;

    IOMUXC_SetPinMux(BLUETOOTH_UART_RX_IOMUX, 0u);
    IOMUXC_SetPinMux(BLUETOOTH_UART_TX_IOMUX, 0u);

    IOMUXC_SetPinConfig(BLUETOOTH_UART_RX_IOMUX, GPIO_SLEW_RATE_CONFIG(GPIO_SLEW_RATE_SLOW) |
                                                 GPIO_DRIVE_STRENGTH_CONFIG(GPIO_DRIVE_STRENGTH_R04) |
                                                 GPIO_SPEED_CONFIG(GPIO_SPEED_FAST_150MHz) |
                                                 GPIO_OPEN_DRAIN_CONFIG(GPIO_OPEN_DRAIN_ENABLED) |
                                                 GPIO_PULLKEEP_CONFIG(GPIO_PULLKEEP_DISABLED) |
                                                 GPIO_PULLKEEP_SELECT_CONFIG(GPIO_PULLKEEP_SELECT_KEEPER) |
                                                 GPIO_PULL_CONFIG(GPIO_PULL_PU_22KOhm) |
                                                 GPIO_HYSTERESIS_CONFIG(GPIO_HYSTERESIS_DISABLED));

    IOMUXC_SetPinConfig(BLUETOOTH_UART_TX_IOMUX, GPIO_SLEW_RATE_CONFIG(GPIO_SLEW_RATE_SLOW) |
                                                 GPIO_DRIVE_STRENGTH_CONFIG(GPIO_DRIVE_STRENGTH_R04) |
                                                 GPIO_SPEED_CONFIG(GPIO_SPEED_FAST_150MHz) |
                                                 GPIO_OPEN_DRAIN_CONFIG(GPIO_OPEN_DRAIN_ENABLED) |
                                                 GPIO_PULLKEEP_CONFIG(GPIO_PULLKEEP_DISABLED) |
                                                 GPIO_PULLKEEP_SELECT_CONFIG(GPIO_PULLKEEP_SELECT_KEEPER) |
                                                 GPIO_PULL_CONFIG(GPIO_PULL_PU_22KOhm) |
                                                 GPIO_HYSTERESIS_CONFIG(GPIO_HYSTERESIS_DISABLED));

    lpuart_config_t uart_config;
    LPUART_GetDefaultConfig(&amp;amp;uart_config);
    uart_config.baudRate_Bps = BLUETOOTH_UART_BAUDRATE;
    uart_config.enableRx     = true;
    uart_config.enableTx     = true;

    status_t status = LPUART_Init(BLUETOOTH_UART_PORT, &amp;amp;uart_config, board_hal_uart_get_frequency());
    APP_ASSERT(status == kStatus_Success, "Failed to initialize UART");

    LPUART_EnableInterrupts(BLUETOOTH_UART_PORT, kLPUART_RxDataRegFullInterruptEnable);
    NVIC_SetPriority(LPUART1_IRQn, BLUETOOTH_UART_INTERRUPT_PRIORITY);
    EnableIRQ(BLUETOOTH_UART_IRQn);

#if defined(FSL_FEATURE_SOC_DMAMUX_COUNT) &amp;amp;&amp;amp; FSL_FEATURE_SOC_DMAMUX_COUNT
    DMAMUX_Init(BT_LPUART_DMAMUX_BASEADDR);
    DMAMUX_SetSource(BT_LPUART_DMAMUX_BASEADDR, LPUART_TX_DMA_CHANNEL, LPUART_TX_DMA_REQUEST);
    DMAMUX_EnableChannel(BT_LPUART_DMAMUX_BASEADDR, LPUART_TX_DMA_CHANNEL);
#endif

    // Initialize the EDMA module
    edma_config_t dma_config;
    EDMA_GetDefaultConfig(&amp;amp;dma_config);
    EDMA_Init(BT_LPUART_DMA_BASEADDR, &amp;amp;dma_config);
    EDMA_CreateHandle(&amp;amp;m_bluetooth_uart.edma_handle, BT_LPUART_DMA_BASEADDR, LPUART_TX_DMA_CHANNEL);

#if defined(FSL_FEATURE_EDMA_HAS_CHANNEL_MUX) &amp;amp;&amp;amp; FSL_FEATURE_EDMA_HAS_CHANNEL_MUX
    EDMA_SetChannelMux(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_TX_DMA_CHANNEL, DEMO_LPUART_TX_EDMA_CHANNEL);
#endif

    // Create LPUART DMA handle
    LPUART_TransferCreateHandleEDMA(BLUETOOTH_UART_PORT,
                                    &amp;amp;m_bluetooth_uart.lpuart_edma_handle,
                                    lpuart_edma_transfer_callback,
                                    NULL,
                                    &amp;amp;m_bluetooth_uart.edma_handle,
                                    NULL);

    log_info("UART initialized");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help with this issue will be appreciated. Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/UART-RX-interrupt-loop/m-p/1364587#M182422</guid>
      <dc:creator>andyteufel</dc:creator>
      <dc:date>2021-11-01T13:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: UART RX interrupt loop</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/UART-RX-interrupt-loop/m-p/1364628#M182431</link>
      <description>&lt;P&gt;I figured it out. See&amp;nbsp;&lt;A href="https://github.com/NXPmicro/mcux-sdk/pull/45" target="_blank"&gt;https://github.com/NXPmicro/mcux-sdk/pull/45&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 16:07:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/UART-RX-interrupt-loop/m-p/1364628#M182431</guid>
      <dc:creator>andyteufel</dc:creator>
      <dc:date>2021-11-01T16:07:43Z</dc:date>
    </item>
  </channel>
</rss>

