This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP138, GPIO interrupt

Hi,

Curretly i have work on OMAP 138 GPIO interrupt, using the Event Combiner, and config as following:

In DSP/BIOS, link the Event to interrupt 7, 8, 9, 10.

bios.HWI.instance("HWI_INT10").useDispatcher = 1;
bios.HWI.instance("HWI_INT10").arg = 3;
bios.HWI.instance("HWI_INT10").fxn = prog.extern("ECM_dispatch");

bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
bios.HWI.instance("HWI_INT9").useDispatcher = 1;
bios.HWI.instance("HWI_INT9").arg = 2;
bios.HWI.instance("HWI_INT9").fxn = prog.extern("ECM_dispatch");

bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
bios.HWI.instance("HWI_INT8").useDispatcher = 1;
bios.HWI.instance("HWI_INT8").arg = 1;
bios.HWI.instance("HWI_INT8").fxn = prog.extern("ECM_dispatch");

bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
bios.HWI.instance("HWI_INT7").useDispatcher = 1;
bios.HWI.instance("HWI_INT7").arg = 0;
bios.HWI.instance("HWI_INT7").fxn = prog.extern("ECM_dispatch");

In code, i have 8 ISR crresponding to 8 GPIO banks:

static GPIO_IntHandlers_t GPIO_ISR_array[CSL_GPIO_NUM_BANKS] =
{
{ &GPIO_Bank0_ISR, 0 },
{ &GPIO_Bank1_ISR, 0 },
{ &GPIO_Bank2_ISR, 0 },
{ &GPIO_Bank3_ISR, 0 },
{ &GPIO_Bank4_ISR, 0 },
{ &GPIO_Bank5_ISR, 0 },
{ &GPIO_Bank6_ISR, 0 },
{ &GPIO_Bank7_ISR, 0 },
{ &GPIO_Bank8_ISR, 0 },
};

And in the initialize, i have plug the 8 ISR to the ECM with the corresponding Event ID:

...

ECM_Attrs ecmattrs = ECM_ATTRS;

ecmattrs.unmask = 1;

ECM_dispatchPlug(GPIO_EventID[bank_id],
(ECM_Fxn)GPIO_ISR_array[bank_id].IntHandler,
&ecmattrs);
GPIO_ISR_array[bank_id].Enabled = TRUE;


/* Enable GPIO bank interrupt */
GPIO_BINTEN |= (1 << bank_id);

    GPIO_setEdgeTrigger(pinNumber, edgeType);

...

The function     GPIO_setEdgeTrigger() is like this:

static INT16 GPIO_setEdgeTrigger(GPIO_PinNumber_t pinNumber, GPIO_EdgeType_t edgeType)
{
UINT32 bank_id = (pinNumber >> 5); /* Get the bank address from upper nibble - divide by 2 - no of banks per 32bit register */
UINT32 pin_id = 1 << (pinNumber & 0x1f); /* Get the pin */
volatile UINT32* gpio_handle;

if(GPIO_RISING_EDGE == edgeType)
{
gpio_handle = (UINT32*) (GPIO_BASE + GPIO_SET_RIS_TRIG_BASE + (GPIO_BASE_OFFSET * bank_id));
/* Set to rising edge trigger */
*gpio_handle = pin_id;
}
else
{
gpio_handle = (UINT32*) (GPIO_BASE + GPIO_SET_FAL_TRIG_BASE + (GPIO_BASE_OFFSET * bank_id));
/* Set to falling edge trigger */
*gpio_handle = pin_id;
}

return 0;
}

Actually, i was using GPIO5_13 and GPIO6_10 as my interrupt source, but the problem is, i only receive band5 interrupt, but the code Never Step into bank6 ISR.

Bank5 is Event 59, Bank6 is Event 62, and all combined as Event1 in ECM, so it should not bank 5 interrupt can receive but back 6 interrupte can't? it doesn't make sence. 

I have check the MUX regester, all the pin should be config as GPIOs.

i have check the GPIO rise edge and failing edge interupt, it seems all right, Don't know is there have bug on ECM Module of DSP/BIOS? 

  • Yang,

    Can you go read some registers to see if the interrupt was triggered?

    1.  See if event 62 is flagged in the EVTFLAG[1] register.  Address is 0x01800004

    2.  Make sure event 62 is unmasked in the EVTMASK[1] register.  Address is 0x01800084 (a 1 means masked, 0 means unmasked)

    Judah

  • hi Judah,

    Thank you! We try the advise, finally, we found the issue is because the GPIO PIN is not the one we intend to interrupt. After change the PIN to the right one, the interrupt happened!

    BRs
    GuoYang