LPUART1 RX Interrupt

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

LPUART1 RX Interrupt

1,827件の閲覧回数
farid_mabrouk
Contributor II

I configured an RX interrupt for LPUART1 as below. However, I am seeing that interrupt occurs only once even though data keeps coming to the every seconds. It appears the interrupt is disabled once the my buffer is full? but I tried to enable it after every read and still could not have it trigger again. Any comments please!

void LPUART1_IRQHandler(void)
{
    uint8_t data;


    /* If new data arrived. */
    if ((kLPUART_RxDataRegFullFlag)&LPUART_GetStatusFlags(LPUART1))
    {
        data = LPUART_ReadByte(LPUART1);

        BarCodeRxBuff[rxIndex] = data;
        rxIndex++;
        if(rxIndex==BUFFER_SIZE)  //buff size is 9
        {
          rxIndex=0;
          BufferFull=true;

        }

    }

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

1,769件の閲覧回数
mjbcswitzerland
Specialist V

Hi

 

Reading a received byte clears the reception interrupt flag and so there is nothing else to be done with respect to this.

However, if you have a receiver overrun or other type of reception error you need to explicitly handle these and clear the status (usually by writing a '1' to the flag in the status register after having read it being set) otherwise the receiver will not receive anything else. Therefore, check the error flags to see whether your problem is due to one of these being set.

 

Regards

 

Mark

[uTasker project developer for Kinetis and i.MX RT]

0 件の賞賛
返信