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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,996 次查看
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 项奖励
回复
1 解答
1,750 次查看
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 项奖励
回复
2 回复数
1,751 次查看
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 项奖励
回复
1,750 次查看
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 项奖励
回复