Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

RTOS/OMAP-L138: GPIO interrupt issue

$
0
0

Part Number:OMAP-L138

Tool/software: TI-RTOS

Hello,

I use pdk 1_0_6 and I know GPIO_LedBlink exmaple but I have problem with GPIO interrupt when I should use more then 1 input pin to interrupt:

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <stdio.h>

#include <ti/board/board.h>
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>

#include "usm_gpio.h"

/**********************************************************************
 ************************** GPIO  *************************************
 **********************************************************************/
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] =
{
    //MMCSD
    GPIO_DEVICE_CONFIG(GPIO_MMC_SDCD_PORT_NUM, GPIO_MMC_SDCD_PIN_NUM) | GPIO_CFG_IN_INT_BOTH_EDGES | GPIO_CFG_INPUT,
    //BUZZER
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_BUZZER_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    //LED_ARRX
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_LED_EXT0_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_LED_EXT1_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_LED_EXT2_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_LED_EXT4_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_LED_EXT5_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_OUTPUT,
    //S4 ->SW1-SW6
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW1_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW2_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW3_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW4_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW5_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM0, GPIO_S4_SW6_PIN_NUM) | GPIO_CFG_IN_INT_NONE | GPIO_CFG_INPUT,
};

/* GPIO Driver call back functions */
GPIO_CallbackFxn gpioCallbackFunctions[] =
{
    //MMCSD
    AppGpioCallbackFxn,
    //BUZZER
    NULL,
    //LED_ARRX
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    //S4 ->SW1-SW6
    AppGpioCallbackFxn2,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
};

GPIO_v0_Config GPIO_v0_config =
{
    gpioPinConfigs,
    gpioCallbackFunctions,
    sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
    sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
    0,
};

void usm_board_initGPIO(void)
{

    GPIO_v0_HwAttrs gpio_cfg;
    /* Get the default SPI init configurations */
    GPIO_socGetInitCfg(GPIO_MMC_SDCD_PORT_NUM, &gpio_cfg);
    /* Modify the default GPIO configurations if necessary */
    //***/
    /* Set the default GPIO init configurations */
    GPIO_socSetInitCfg(GPIO_MMC_SDCD_PORT_NUM, &gpio_cfg);
    /* Setup GPIO interrupt configurations */
    GPIO_socSetBankInt(GPIO_MMC_SDCD_PORT_NUM, GPIO_MMC_SDCD_PIN_NUM, NULL);
    GPIO_socSetBankInt(GPIO_MMC_SDCD_PORT_NUM, GPIO_S4_SW2_PIN_NUM, NULL);

    /* GPIO initialization */
    GPIO_init();
    /* Enable GPIO interrupt on the specific gpio pin */
    GPIO_enableInt(GPIO_PIN_MMC_SDCD);
    GPIO_enableInt(GPIO_PIN_S4_SW2);

}

AppGpioCallbackFxn and AppGpioCallbackFxn2 I have in other file but intterupt form GPIO_PIN_MMC_SDCD is correct but GPIO_PIN_S4_SW2 not interrupt...
When I changed the order in gpioPinConfigs this works correctly GPIO_PIN_S4_SW2 abut not GPIO_PIN_MMC_SDCD ...

When I checked in GPIO Interrupt Status the interrupt status is 1.
Where is the problem?

Best regards,
Patryk


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>