Using EIRQ3 in a new project

HI All,

I need to use an external interrupt for a new project with the 9P module.

EIRQ3 on GPIO101 seems to be reasonably free(only used on dev board for I2C IO) and does not conflict with other signals.

I therefore started with the sample application “Wakeup Interrupt Sample” and have tried to modify it to use EIRQ3. This used the wakeup button on the dev board and shows how to use EIRQ2.

I have revised the interrupt routine, hopefully to clear EiRQ3 as follows

static int pdirq3Isr(void *context)
    static int level = 1;

    (void) context;

    /* clear the interrupt */            
    narm_write_reg (NA_SCM_EICR_REG, NA_SCM_EICR_3_ADDRESS, clr, 1);
    narm_write_reg (NA_SCM_EICR_REG, NA_SCM_EICR_3_ADDRESS, clr, 0);

    naGpioSetOutputValue(GPIO_USER_LED1, level++);
    level %= 2;
    naGpioSetOutputValue(GPIO_USER_LED2, level);
    return 0;    

Within the GPIO configuration function I have set up the GPIO as an iinterrupt:

    ret = naGpioSetInterrupt(101, 1, 1);
    if (ret != EXTERNAL3_INTERRUPT)
        printf("naGpioSetInterrupt(101) returns %d.
", ret);
        return ret;

I then set up the ISR with:

    ret = naIsrInstall(EXTERNAL3_INTERRUPT, pdirq3Isr, NULL);
    if (ret != 0)
        printf ("naIsrInstall failure[%d]
", ret);
        return ret;

However when I call naIsrInstall the system seems to crash.

Can anyone offer any advice where I am going wrong


I tried it out and was able to get it to work.

Make sure you have the latest patches first.

You need to also configure the settings in gpio.h, i.e:

#define BSP_GPIO_MUX_IRQ_3


I then used the following code (attached is the full copy):

int retval, prevCounter = -1;

//setup ISR
retval = naIsrInstall(EXTERNAL3_INTERRUPT, irqIsr, NULL);

	printf("Error setting up ISR %d

", retval);

//setup GPIO
retval = NAconfigureGPIOpin(101, NA_GPIO_FUNC2_STATE, 0);

	printf("Error setting up GPIO %d

", retval);

//watch counter
	if(prevCounter < counter)
		printf("Counter %d

", counter);
prevCounter = counter;


Many thanks.

I have it working now with your code