k64's UART2 Interrupt only gets two chars

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

k64's UART2 Interrupt only gets two chars

跳至解决方案
690 次查看
joao_ribeiro
Contributor IV

Hello,

I have always used UART0 without any trouble, but now I need also to use UART2. I have configured UART2 with the MCUxpresso Peripherals tab making sure that UART2 is in Bus clock. I can send commands without any problem but the interrupt routine only gets the first two chars.

I am sure that the issue is a simple mistake, but I can't figure out what it is really. Do you have any hints?

Thank you in advance

Here is my interrupt handlers from UART0 and UART2

void UART0_RX_TX_IRQHandler(void){

uint8_t data;

if( (kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART_0_PERIPHERAL) ){

data = UART_ReadByte(UART_0_PERIPHERAL);//read the UART buffer

// If ring buffer is not full, add data to ring buffer.
if (((UART0_endRingBuffer + 1) % UART0_RING_BUFFER_SIZE) != UART0_startRingBuffer)
{
UART0_RX_RingBuffer[UART0_endRingBuffer] = data;
UART0_endRingBuffer++;
UART0_endRingBuffer %= UART0_RING_BUFFER_SIZE;
}
}
}

void UART2_RX_TX_IRQHandler(void){

uint8_t data;

if( (kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART_2_PERIPHERAL) ){

data = UART_ReadByte(UART_2_PERIPHERAL);//read the UART buffer

// If ring buffer is not full, add data to ring buffer.
if (((UART2_endRingBuffer + 1) % UART2_RING_BUFFER_SIZE) != UART2_startRingBuffer)
{
UART2_RX_RingBuffer[UART2_endRingBuffer] = data;
UART2_endRingBuffer++;
UART2_endRingBuffer %= UART2_RING_BUFFER_SIZE;
}
}
}

Regards

1 解答
586 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi João,

Please notice the difference of receive FIFO.

UART FIFO K64.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
587 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi João,

Please notice the difference of receive FIFO.

UART FIFO K64.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------