imxrt105x uart read

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imxrt105x uart read

424 Views
sangam_swami
Contributor I

Hi,

I am trying to read UART data in imxrt1050, but am not able to read the data from the port.

Below is the sample code snippet.

int imxrt_lowgetc(void)
{
    uint32_t rxd;
    while ((getreg32(IMXRT_CONSOLE_BASE + IMXRT_LPUART_STAT_OFFSET) & LPUART_STAT_RDRF(1U)
) == 0) {
    }

    /* Receive the character written into the UART_RXD register. */

    rxd = getreg32(IMXRT_CONSOLE_BASE + IMXRT_LPUART_DATA_OFFSET);
    return (rxd & LPUART_DATA_MASK) >> LPUART_DATA_SHIFT;
}

May I know if there is any issue with above code

Labels (2)
0 Kudos
1 Reply

373 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello, 

You can refer to the UART drivers that we provide within the SDK. Here you will find multiple functions to read data from the UART. Also, within the SDK you will find examples that show how to implement these drivers either in polling or interrupt mode. 

Have a great day,
Victor

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos