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.

GPIO interrupt configuration on AM/DM37x EVM (omap3530)

Other Parts Discussed in Thread: OMAP3530

Hi, For our development environment, we are using AM/DM37x EVM (OMAP3530 evm based) and Windows Embedded Compact 7 as OS.  Also, BSP_WINCE_ARM_A8_02_30_00_Source version used for driver or OS customization.  

I wanted to used one GPIO as interrupt (IRQ line) for the device which attached with the EVM over spi interface.  I want to find a dedicated gpio line for this purpose.  I read the AM/DM37x TRM, and analysed the source files to find one.

First up all, I took touchscreePdd.cpp example for understanding of configuring the gpio as an interrupt.  Here, gpio pin 175 is used as interrupt for TS_nPEN_IRQ.  But in the structure, it's assigned a value 'zero' for corresponding gpio.

0,                                              //nPenGPIO  and 

// Get the IRQ for the GPIO
s_TouchDevice.nPenIRQ = GPIOGetSystemIrq(s_TouchDevice.hGPIO, s_TouchDevice.nPenGPIO);

// IRQ for GPIOs mapping

#define IRQ_GPIO_0  128

DWORD BSPGetGpioIrq(DWORD id)
{
return id + IRQ_GPIO_0;
}

Finally, the irq for gpio is returned as 128.  Can I know why this #define IRQ_GPIO_0  128 is assigned.  What is the reason for this...I couldn't quite understand this logic.

Best Regards,

Karthick

  • Dear Karthick,
    Greetings!!!

    You are using one GPIO pin as IRQ and in return you are getting 128. Basically, there are certain IRQ lines that will be registered for device and when the interrupt generated, one out of many IRQ line was assigned for the particular interrupt based device and 128 is assigned to that GPIO 175.

    If, this helps you to solve the issue then please like this..
  • Hi Partap, thanks for the reply.
    I could n't quite get the point you are refering to. If I want to use gpio 148 as interrupt line for my peripheral device which is interfaced with AM/DM37x EVM. In such case, what could be the id should be returned by the following function. (or what's the id parameter should I pass)

    DWORD BSPGetGpioIrq(DWORD id)
    {
    return id + IRQ_GPIO_0;
    }

    please clarify.

    Thank you,
    Karthick
  • HI Karthick,

    I don't have your source code..
    Please share from the call is made to that function.
  • To use the gpio148 as an interrupt line, I use the following code
    in .h file
    static TRF7970_DEV_CONTEXT s_trf7970 = {
    0, //nTrfGPIO
    0, //nTrfIRQ
    };

    in .c file
    TRF7970InitializeHardware(void)
    {
    // Setup nTRFIRQ for input mode, falling edge detect
    GPIOSetMode(s_trf7970.hGPIO, s_trf7970.nTrfGPIO, GPIO_DIR_INPUT|GPIO_INT_HIGH_LOW);

    // Get the IRQ for the GPIO
    s_trf7970.nTrfGPIO = GPIOGetSystemIrq(s_trf7970.hGPIO, s_trf7970.nTrfGPIO);

    // Get sysintr values from the OAL for TRFIRQ interrupt
    if (!KernelIoControl(
    IOCTL_HAL_REQUEST_SYSINTR,
    &s_trf7970.nTrfIRQ,
    sizeof(s_trf7970.nTrfIRQ),
    &s_trf7970.dwSysIntr,
    sizeof(s_trf7970.dwSysIntr),
    NULL
    ) )
    }

    please let know of the sequence should I follow to configure the gpio 148 as an interrupt.....(may be in a high level with function calls)

    Regards,
    Karthick
  • Let's simplify the question: How to configure a gpio interrupt (for gpio 5th module and 20th pin - ie gpio148 in AM37x processor)......Here is the code snippet that I follow.

    // Setup nTRFIRQ for input mode, falling edge detect, debounce enable
    GPIOSetMode(s_trf7970.hGPIO, s_trf7970.nTrfGPIO, GPIO_DIR_INPUT|GPIO_INT_HIGH_LOW|GPIO_DEBOUNCE_ENABLE);

    // Get the IRQ for the GPIO
    s_trf7970.nTrfGPIO = GPIOGetSystemIrq(s_trf7970.hGPIO, s_trf7970.nTrfGPIO);

    For me I wanted to know which value should 's_trf7970.nTrfGPIO' has (should pass)? If you clarify that would be a great work...

    Thank you,
    Karthick