the problem about UART isr

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

the problem about UART isr

1,222 Views
wyflsxy
Contributor II

hello ,it's about the problem about UART ISR

 

I used to compile environment is KDS3.0

Using a KSDK1.2 and MQX4.2,and my board is frdmk64f

 

I want to rec data form uart with ISR

but when I install the uart0 isr,

the Interrupt handler is constantly triggered, whatever I have to send or receive data from UART0

I don't know what's the problem

Is it because UART0 is the default input port?

In addition, I want to know why  the code “printf("\ncounter = %d\n", g_isr_data.COUNTER);

could output data to uart0

 

 

 

void new_isr(void *user_isr_ptr)

{

   MY_ISR_STRUCT_PTR  isr_ptr;

 

 

   isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;

   isr_ptr->COUNTER++;

   /* It is common to chain interrupts */

   /* isr_ptr->OLD_ISR(isr_ptr->OLD_ISR_DATA); */

}

 

main_task(){ 

INT_SYS_EnableIRQ(SW_IRQ);

 

 

    /** Demonstration of mqx interrupt installation. Works with vector table placed in RW as well as RO memory **/

    g_isr_data.COUNTER      = 0;

    g_isr_data.OLD_ISR_DATA = _int_get_isr_data(SW_IRQ);

    g_isr_data.OLD_ISR      = _int_get_isr(SW_IRQ);

 

 

    /* Install MQX isr routine. This function does not change vector table */

    old_isr = _int_install_isr(SW_IRQ, new_isr, &g_isr_data);

}

Labels (1)
0 Kudos
5 Replies

529 Views
ivadorazinova
NXP Employee
NXP Employee

Hi wang yufei,

please what do you use for MCU?

Best Regards,

Iva

0 Kudos

529 Views
wyflsxy
Contributor II

what did you mean?

I want to receive data form uart by interrupt

but,when I install a uart0 interrupt about like "_int_install_isr(SW_IRQ, new_isr, &g_isr_data);"

the interrupt funtion "new_isr()"was constantly triggered, whatever I havn't send or receive data from UART0

Alice_YangHui_Ma

0 Kudos

529 Views
ivadorazinova
NXP Employee
NXP Employee

Hi wang,

please take a look at these documents :

How To: Using Interrupt Handlers in MQX with KSDK

or Interrupt handling with PE

Interrupt handling with KSDK and Kinetis Design Studio

I hope this helps.

Best Regards,

Iva

0 Kudos

529 Views
wyflsxy
Contributor II

I saw the demo and found that it need to clear the interrupt flag bit in GPIO interrupt program with "GPIO_DRV_ClearPinIntFlag (kGpioSW2);"

So  did the UART interrupt program also need to clear the interrupt flag ?

however I did not found the clear interrupt flag programe for uart in the API or the  header files?

could you help me?

0 Kudos

529 Views
wyflsxy
Contributor II

my project is build with ksdk1.2 with out PE,how can I change the "printf" output from UART0 to UART1?

0 Kudos