Tool/software: TI-RTOS
I'm trying to set up three GPIO pins. Based off the structure of some of the examples included in CCS8 i was able to get two inputs successfully working, using PA2 and PA3. My third input is being run off a seperate port base, PD0. I've verified that the hardware switches that I am using are correctly sending into pin PD0. I suspect that this problem has something to do with port D having ADC's but I'm not certain. I know that PD[7], as well as PC[3:0] and PE[7], are locked but I don't think that should affect my ability to use PD0.
/* * =============================== GPIO =============================== */ /* Place into subsections to allow the TI linker to remove items properly */ #if defined(__TI_COMPILER_VERSION__) #pragma DATA_SECTION(GPIOTiva_config, ".const:GPIOTiva_config") #endif #include <ti/drivers/GPIO.h> #include <ti/drivers/gpio/GPIOTiva.h> /* * Array of Pin configurations * NOTE: The order of the pin configurations must coincide with what was * defined in EK_TM4C129EXL.h * NOTE: Pins not used for interrupts should be placed at the end of the * array. Callback entries can be omitted from callbacks array to * reduce memory usage. */ GPIO_PinConfig gpioPinConfigs[] = { /* Input pins */ /* EK_TM4C129EXL_USR_INP1 */ GPIOTiva_PA_2 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, /* EK_TM4C129EXL_USR_INP2 */ GPIOTiva_PA_3 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, //EK_TM4C129EXL_GPIO_D0 GPIOTiva_PD_0 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, /* Output pins */ /* EK_TM4C129EXL_USR_D1 */ GPIOTiva_PN_1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW, /* EK_TM4C129EXL_USR_D2 */ GPIOTiva_PN_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW }; /* * Array of callback function pointers * NOTE: The order of the pin configurations must coincide with what was * defined in EK_TM4C129EXL.h * NOTE: Pins not used for interrupts can be omitted from callbacks array to * reduce memory usage (if placed at end of gpioPinConfigs array). */ GPIO_CallbackFxn gpioCallbackFunctions[] = { NULL, /* EK_TM4C129EXL_USR_IMP1 */ NULL, /* EK_TM4C129EXL_USR_IMP2 */ NULL // Light test gpio on port D0 }; /* The device-specific GPIO_config structure */ const GPIOTiva_Config GPIOTiva_config = { .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig), .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn), .intPriority = (~0) }; /* * ======== EK_TM4C129EXL_initGPIO ======== */ void EK_TM4C129EXL_initGPIO(void) { GPIO_init(); }
bit from the board header file
typedef enum EK_TM4C129EXL_GPIOName { EK_TM4C129EXL_USR_IMP1 = 0, EK_TM4C129EXL_USR_IMP2, EK_TM4C129EXL_GPIO_D0, EK_TM4C129EXL_D1, EK_TM4C129EXL_D2, EK_TM4C129EXL_GPIOCOUNT } EK_TM4C129EXL_GPIOName;
and then finally the part in the main where I handle creating the interrupts and tying them to a function
GPIO_setCallback(EK_TM4C129EXL_USR_IMP1, gpioButtonFxn0); GPIO_enableInt(EK_TM4C129EXL_USR_IMP1); GPIO_setCallback(EK_TM4C129EXL_USR_IMP2, gpioButtonFxn1); GPIO_enableInt(EK_TM4C129EXL_USR_IMP2); GPIO_setCallback(EK_TM4C129EXL_GPIO_D0, gpioButtonFxn2); GPIO_enableInt(EK_TM4C129EXL_GPIO_D0);