AnsweredAssumed Answered

imxrt105x uart read

Question asked by sangamanatha swamy on Nov 3, 2019
Latest reply on Nov 5, 2019 by Victor Jimenez

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

Outcomes