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?
Solved! Go to Solution.
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
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
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