how to disable/enable interrupts within ISR in IAR workbench

Started by Harish Hrr July 16, 2009
All,

I am working on LPC2468 using IAR workbench IDE.
I have configured GPIO2-port-28 as input. This port/channel is working in
polling mode, but i want to configure it in interrupt mode. the below
configuration i have used to configure it in interrupt mode. The problem i
am facing is the ISR is getting called, but control does not go back to the
main funciton after ISR execution.

- FIO2MASK |= (1<<28); // mask enabled
- FIO2DIR |= (1<<28); // conf as Input
- IO2_INT_EN_R = (1u << 28); // Enabling of rising edge interrupt on GPIO
side
- install_irq (EINT3_INT, (void *)GPIO_Handler, HIGHEST_PRIORITY); //
configuration of EINT3 for GPIO

My ISR/handler function is as follows:

__irq __nested __arm void WaterMeter_Handler_main (void)
{
WM_Counter++;
VICVectAddr = 0; /* Acknowledge Interrupt */
return;
}

I suspect the problem may be with enabling/disabling of interrupt within the
ISR. plese let me know how to do this in IAR workbench environment.

regards,
Harish.


Hi Harish,
--- In l..., Harish Hrr wrote:
> The problem i
> am facing is the ISR is getting called, but control does not go back to the
> main funciton after ISR execution.
>
>
> My ISR/handler function is as follows:
>
> __irq __nested __arm void WaterMeter_Handler_main (void)
> {
> WM_Counter++;
> VICVectAddr = 0; /* Acknowledge Interrupt */
> return;
> }

You must also clear the pending interrupt request in the GPIO module itself. Otherwise it will keep on firing interrupts. Try adding this line to your interrupt handler:
IO2IntClr = (1 << 28);

Regards,
Rolf

Hi Harish,
--- In l..., Harish Hrr wrote:
> The problem i
> am facing is the ISR is getting called, but control does not go back to the
> main funciton after ISR execution.
>
>
> My ISR/handler function is as follows:
>
> __irq __nested __arm void WaterMeter_Handler_main (void)
> {
> WM_Counter++;
> VICVectAddr = 0; /* Acknowledge Interrupt */
> return;
> }

You must also clear the pending interrupt request in the GPIO module itself. Otherwise it will keep on firing interrupts. Try adding this line to your interrupt handler:
IO2IntClr = (1 << 28);

Regards,
Rolf

All,

I am working on LPC2468 using IAR workbench IDE.
I have configured GPIO2-port-28 as input. This port/channel is working in
polling mode, but i want to configure it in interrupt mode. the below
configuration i have used to configure it in interrupt mode. The problem i
am facing is the ISR is getting called, but control does not go back to the
main funciton after ISR execution.

- FIO2MASK |= (1<<28); // mask enabled
- FIO2DIR |= (1<<28); // conf as Input
- IO2_INT_EN_R = (1u << 28); // Enabling of rising edge interrupt on GPIO
side
- install_irq (EINT3_INT, (void *)GPIO_Handler, HIGHEST_PRIORITY); //
configuration of EINT3 for GPIO

My ISR/handler function is as follows:

__irq __nested __arm void WaterMeter_Handler_main (void)
{
WM_Counter++;
VICVectAddr = 0; /* Acknowledge Interrupt */
return;
}

I suspect the problem may be with enabling/disabling of interrupt within the
ISR. plese let me know how to do this in IAR workbench environment.

regards,
Harish.