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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

2,313件の閲覧回数
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.  

ラベル(1)
0 件の賞賛
返信
1 返信

1,718件の閲覧回数
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 件の賞賛
返信