Rx Tx UART interrupt

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

Rx Tx UART interrupt

1,415 Views
mpc8377e
Contributor I

Hi,

 

Does MQX gives us a way to know whether the interrupt is for Rx or Tx if i have common ISR for recieving / transmitting for UART, if it has a way then how to know it?

 

/Raghu

0 Kudos
4 Replies

514 Views
mpc8377e
Contributor I

I am testing the UART interrupt on k40 tower module board.

0 Kudos

514 Views
c0170
Senior Contributor III

Hi mpc8377e,

 

your application shares one interrupt for RX and also TX. Simply read the flag which causes the interrupt to be invoked. Are you using kuart int init, because there's _kuart_int_rx_tx_isr function. You can find the source code in source/io/serial.

 

Regards,

MartinK

0 Kudos

514 Views
mpc8377e
Contributor I

Hi Kojito,

 

I have one more question on ISR:

 

I have installed my own isr like this:

 

_int_install_isr(INT_UART3_RX_TX, uart_rx_tx_isr, NULL);
   _cortex_int_init(INT_UART3_RX_TX, 2, TRUE);
   _cortex_int_enable(INT_UART3_RX_TX);     

ISR:

 

void
uart_rx_tx_isr( pointer user_isr_ptr )

{

volatile int_32 value;

if (sci_ptr->S1 & UART_S1_RDRF_MASK)

{
      value = sci_ptr->D;
   }

 

By doing this i am unable to get the exact data in varilabe "value". Is there any way to read the exact data from UART? I am testing this on tower module k40.

 

0 Kudos

514 Views
mpc8377e
Contributor I

Hi,

 

I could able to read the character by adding code like this in ISR:

 

uart_rx_tx_isr( pointer user_isr_ptr )

{

volatile int_32 data;

if ((UART_S1_REG(UART3_BASE_PTR) & UART_S1_RDRF_MASK))
{
            data = UART_D_REG(UART3_BASE_PTR);    
}

}

 

But the problem here is that the ISR will trigger only once eventhough the packet has more than 1 byte (ex. 10 bytes), it reads only first byte. The ISR should be triggered 10 times i believe to get the complete packet.

 

Any suggestions?

 

I am using kinetis k40 board.

 

 

0 Kudos