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,998件の閲覧回数
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,752件の閲覧回数
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,753件の閲覧回数
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,752件の閲覧回数
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 件の賞賛
返信