FRDM K82F with SDK LPUART receive interrupt stops firing after 6-8 times

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

FRDM K82F with SDK LPUART receive interrupt stops firing after 6-8 times

Jump to solution
1,084 Views
aronheck
Contributor I

Hello,

I have the following problem. My uart interrupt only fires 6-8 times and never again after that.
It doesn't matter for how long the FRDM K82F runs before receiving the first batch of data, it always happens after the first 6-8 bytes.

Here is some code from my interrupt routine.

void UART_RECEIVE_INTERRUPT(void){
   uint8_t data;
   uint32_t flags = (kLPUART_RxDataRegFullFlag | kLPUART_RxOverrunFlag) &                            LPUART_GetStatusFlags(ESP_UART);
   if (flags){
      data = LPUART_ReadByte(ESP_UART);
      if((rxIndex + 1) % BUFFER_SIZE != txIndex){
         ringBuffer[rxIndex] = data;
         rxIndex++;
         rxIndex %= BUFFER_SIZE;
      }
   }
}

Has anybody encountered this behaviour before?

0 Kudos
1 Solution
838 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Aron,

I suppose that overrun event happens, which leads to the fact that the next character can not be accepted, interrupt does not occurs.

1)Do you use FIFO  mode? if it is the case, read multiple data from FIFO in one ISR or disable FIFO mode.

2)If you check both kLPUART_RxDataRegFullFlag | kLPUART_RxOverrunFlag, pls handle them separately, for example

if(kLPUART_RxDataRegFullFlag&LPUART_GetStatusFlags(ESP_UART);)

{

}

if( kLPUART_RxOverrunFlag &LPUART_GetStatusFlags(ESP_UART);)

{

//clear FIFO by setting the RXFLUSH bit in LPUARTx_FIFO

}

Hope it can help you

BR

Xiangjun Rong

View solution in original post

0 Kudos
2 Replies
839 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Aron,

I suppose that overrun event happens, which leads to the fact that the next character can not be accepted, interrupt does not occurs.

1)Do you use FIFO  mode? if it is the case, read multiple data from FIFO in one ISR or disable FIFO mode.

2)If you check both kLPUART_RxDataRegFullFlag | kLPUART_RxOverrunFlag, pls handle them separately, for example

if(kLPUART_RxDataRegFullFlag&LPUART_GetStatusFlags(ESP_UART);)

{

}

if( kLPUART_RxOverrunFlag &LPUART_GetStatusFlags(ESP_UART);)

{

//clear FIFO by setting the RXFLUSH bit in LPUARTx_FIFO

}

Hope it can help you

BR

Xiangjun Rong

0 Kudos
838 Views
aronheck
Contributor I

Thank you for your answer. I fully disabled the FIFO mode and cleared the overrun when it happens as you suggested.

I also handled the interrupts seperatelly.

This solved my problem.

Thanks again.

Aron

0 Kudos