k64's UART2 Interrupt only gets two chars

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

k64's UART2 Interrupt only gets two chars

Jump to solution
516 Views
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 Solution
412 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
413 Views
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!
-----------------------------------------------------------------------------------------------------------------------