LPUART1 RX Interrupt

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

LPUART1 RX Interrupt

586 Views
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;

        }

    }

Labels (1)
0 Kudos
1 Reply

528 Views
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 Kudos