0

Hello,

I’m using an RX610 Stick board, I need to trigger a process from an external IRQ, for now I’m using one of the onboard push buttons as interrupt source, this button is connected to a pin assigned as IRQ7-B.

After system reset, all other modules work ok (power, led panel, UART – which uses an IRQ for rx-, etc). When I press the button for the 1st time, the interrupt controller detects it, executes the correspondent IRQ handler correctly and returns to the main program loop, but after that, no other IRQs are detected anymore, so if I press the button again nothing happens, even the UART RX – which is also IRQ based and before pressing the button was working ok – now doesn’t work (not detected). Seems like the ICU gets stuck after the irq was executed.

The code I’m using for now is very simple and goes like this:

After reset I configure the pin P1_7 for the button as:

PORT1.DDR.BIT.B7 = 0; // set pin as input
ICU.IER[8].BIT.IEN7 = 0; // IRQ7 temporarily disabled
IOPORT.PFCR9.BIT.ITS7 = 1; // P17 is designated as IRQ7-B
PORT1.ICR.BIT.B7 = 1; // P17 buffer enable
ICU.IRQCR[7].BYTE = 8; // IRQ7 detect on rising edge
ICU.IPR[0x27].BYTE = 5; // IRQ7 priority level 5
ICU.IR[71].BYTE = 0; // IRQ7 clear flag
ICU.IRQER[7].BYTE = 1; // IRQ7 detection enabled
ICU.IER[8].BIT.IEN7 = 1; // IRQ7 enable

 

Here’s the IRQ7 handler:

void INT_Excep_IRQ7(void){gFlags |= 1;}

 

And in the main loop I have:

if (gFlags & 1) { PORTE.DR.BYTE ^= 0x1; // led toggle }

 

As mentioned, only the first time I press the button the handler is executed (led toggles), further pressings don’t do anything. The main loop is not hanged (other functions work ok), but anything that involves the interrupt controller doesn’t work (e.g. UART RX doesn’t work).

 

Any suggestions?

thanks

Attila Banyai answered