# How to get external IRQ's working on flashed image, works when debugging.

**URL:** <https://forums.digi.com/t/how-to-get-external-irqs-working-on-flashed-image-works-when-debugging/6033>\
**Category:** NET+OS\
**Created:** [October 7, 2010, 2:24pm UTC](https://forums.digi.com/t/how-to-get-external-irqs-working-on-flashed-image-works-when-debugging/6033 "2010-10-07T14:24:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesarm97](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@jamesarm97](https://forums.digi.com/u/jamesarm97)\
**Post date:** [October 7, 2010, 2:24pm UTC](https://forums.digi.com/t/how-to-get-external-irqs-working-on-flashed-image-works-when-debugging/6033/1 "2010-10-07T14:24:32Z")

</div>

I have the ConnectCore 9C and NetOS 7.5. I have an external RTC and IO Expander both connected to the IRQ2 and IRQ3 lines. I have the GPIO configured to use these inputs as falling edge interrupts. I install two interrupt handlers in the application start function then enable the interrupts. The interrupt routines are really simple, they clear the interrupt register then increment a counter. When I am debugging with the Jtag these function correctly and I can see the counter incrementing. The problem is when I flash the ConnectCore and boot without the debugger we seem to get 1 interrupt then no more. I have tried everything I can think of.

It also looks like maybe the connectcore is driving the IRQ lines low after bootup as I see the IRQ lines go from high to low and stay that way. If I hold down reset the lines stay high and I can make the external chips pull it low. Something in bootup from the flash memory seems to be setting the lines as outputs even though our customized bsp / gpio.c files set them as inputs / irq lines.

The timer interrupts are working, just not external IRQ2 & 3

gpio.h

#define BSP\_GPIO\_MUX\_IRQ\_2 BSP\_GPIO\_MUX\_USE\_PRIMARY\_PATH

#define BSP\_GPIO\_MUX\_IRQ\_3 BSP\_GPIO\_MUX\_USE\_ALTERNATE\_PATH

#define BSP\_GPIO\_INITIAL\_STATE\_PIN18 BSP\_GPIO\_MUX\_IRQ\_FALLING\_EDGE

#define BSP\_GPIO\_INITIAL\_STATE\_PIN32 BSP\_GPIO\_MUX\_IRQ\_FALLING\_EDGE

applicationStart:

printf("Installing RTC IRQ2…  
");  
result = naIsrInstall(EXTERNAL2\_INTERRUPT, (MC\_ISR\_HANDLER)external\_irq2\_isr, NULL);

if (result != 0)  
{  
printf ("NAconfigureGPIOpin failure[%d]  
", result);  
}

naInterruptEnable(EXTERNAL2\_INTERRUPT);  
naInterruptEnable(EXTERNAL3\_INTERRUPT);

narm\_write\_reg(NA\_SCM\_EXTIRQ2\_REG, NA\_SCM\_EXTIRQ2\_REG\_ADDR, clr, 1);  
narm\_write\_reg(NA\_SCM\_EXTIRQ2\_REG, NA\_SCM\_EXTIRQ2\_REG\_ADDR, clr, 0);  
narm\_write\_reg(NA\_SCM\_EXTIRQ3\_REG, NA\_SCM\_EXTIRQ2\_REG\_ADDR, clr, 1); narm\_write\_reg(NA\_SCM\_EXTIRQ3\_REG, NA\_SCM\_EXTIRQ2\_REG\_ADDR, clr, 0);

tx\_interrupt\_control(TX\_INT\_ENABLE);

IRQ Function:

//RTC IRQ2  
void external\_irq2\_isr(void \* param)  
{  
/\* set the clr bit high in the external IRQ0 register to clear register \*/  
narm\_write\_reg(NA\_SCM\_EXTIRQ2\_REG, NA\_SCM\_EXTIRQ2\_REG\_ADDR, clr, 1);

```
/* set the clr bit low in the external IRQ0 register */
narm_write_reg(NA_SCM_EXTIRQ2_REG, NA_SCM_EXTIRQ2_REG_ADDR, clr, 0);
NAsetGPIOpin(LED_RSSI, 1);
isr_int_count2++; /* keep track of interrupts fired */
return;

```

}
