Rx Tx UART interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Rx Tx UART interrupt

1,424件の閲覧回数
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 件の賞賛
4 返答(返信)

523件の閲覧回数
mpc8377e
Contributor I

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

0 件の賞賛

523件の閲覧回数
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 件の賞賛

523件の閲覧回数
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 件の賞賛

523件の閲覧回数
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 件の賞賛