How to read UART Rx FIFO when triggered interrupt for 8 byte is generated ?

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

How to read UART Rx FIFO when triggered interrupt for 8 byte is generated ?

1,582 Views
balwant
Contributor I

I am working on UART in which i want Interrupt to be invoke after 8 bytes of data is received in FIFO. How to read this FIFO after interrupt is generated.  

Labels (1)
0 Kudos
1 Reply

987 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi BALWANT BISHNOI.

1. Interrupt is invoked after 8 bytes of data is received in FIFO.

  You can configure this register:

pastedImage_1.png

2. How to read this FIFO after interrupt is generated.  

  You can read it like this:

/* Read data through the UART peripheral (non-blocking) */
int Chip_UART_Read(LPC_USART_T *pUART, void *data, int numBytes)
{
    int readBytes = 0;
    uint8_t *p8 = (uint8_t *) data;

    /* Send until the transmit FIFO is full or out of bytes */
    while ((readBytes < numBytes) &&
           ((Chip_UART_ReadLineStatus(pUART) & UART_LSR_RDR) != 0)) {
        *p8 = Chip_UART_ReadByte(pUART);
        p8++;
        readBytes++;
    }

    return readBytes;
}

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos