Tool/software: TI-RTOS
I wish to configure a GPIO pin to give an interrupt on a low going square Wave signal from DS3231 RTC chip.
I have started with the gpiointerrupt example and made the following changes. The intention was to use TI-RTOS to setup 1 callback per port interrupt and then use the index value to switch to the appropriate pin action. I added a GPIO pin setting to gpioPinConfigs in MSP_EXP430F5529LP.c and a GPIO name for the extra pin in MSP_EXP430F5529LP.h.
/* * ======== MSP_EXP430F5529LP.c ======== * This file is responsible for setting up the board specific items for the * MSP_EXP430F5529LP board. */ GPIO_PinConfig gpioPinConfigs[] = { /* Input pins */ /* MSP_EXP430F5529LP_RTC P2_0 Input with Falling Edge Interrupt*/ GPIOMSP430_P2_0 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING, /* MSP_EXP430F5529LP_S1 */ GPIOMSP430_P2_1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, /* MSP_EXP430F5529LP_S2 */ GPIOMSP430_P1_1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING, /* Output pins */ /* MSP_EXP430F5529LP_LED1 */ GPIOMSP430_P1_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW, /* MSP_EXP430F5529LP_LED2 */ GPIOMSP430_P4_7 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW, }; . . . /** ============================================================================ * @file MSP_EXP430F5529LP.h * * @brief MSP_EXP430F5529LP Board Specific APIs * * The MSP_EXP430F5529LP header file should be included in an application as * follows: * @code * #include <MSP_EXP430F5529LP.h> * @endcode * * ============================================================================ */ /*! * @def MSP_EXP430F5529LP_GPIOName * @brief Enum of GPIO names on the MSP_EXP430F5529LP dev board * in ame order as PinConfigs[] */ typedef enum MSP_EXP430F5529LP_GPIOName { MSP_EXP430F5529LP_RTC = 0, /* port 2 pin 0 */ MSP_EXP430F5529LP_S1 , /* port 2 pin 1 */ MSP_EXP430F5529LP_S2, /* port 1 pin 1 */ MSP_EXP430F5529LP_LED1, MSP_EXP430F5529LP_LED2, MSP_EXP430F5529LP_GPIOCOUNT } MSP_EXP430F5529LP_GPIOName; /* main */ /* variable to be read by GUI Composer */ int count1 = 0; int count2 = 0; /* variable to be read by GUI Composer */ //int rtccount = 0; /* * ======== gpioPortFxn2 ======== * Callback function for the Port 2 * if index is position in gpioPinConfigs[] then we should get 0 or 1 */ void gpioPortFxn2(unsigned int index) { /* Clear the GPIO interrupt and toggle an LED */ GPIO_toggle(Board_LED1); if (count2++ == 100) { count2 = 0; } System_printf("Port2 Int %d, %d\n", count2 , index); System_flush(); } /* * ======== gpioPortFxn1 ======== * Callback function for the GPIO interrupt on Board_BUTTON0. * * if index is position in gpioPinConfigs[] then we should get 2 */ void gpioPortFxn1(unsigned int index) { /* Clear the GPIO interrupt and toggle an LED */ GPIO_toggle(Board_LED0); if (count1++ == 100) { count1 = 0; } System_printf("Port1 Int %d, %d\n", count1 , index); System_flush(); } /* */ /* * ======== main ======== */ int main(void) { /* Call board init functions */ Board_initGeneral(); Board_initGPIO(); Board_initUART(); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON); System_printf("Starting the GPIO Interrupt example\nSystem provider is set" " to SysMin. Halt the target to view any SysMin contents in" " ROV.\n"); /* SysMin will only print to the console when you call flush or exit */ System_flush(); // /* install callbacks */ GPIO_setCallback(MSP_EXP430F5529LP_RTC, gpioPortFxn2); GPIO_setCallback(Board_BUTTON0, gpioPortFxn1); GPIO_setCallback(Board_BUTTON1, gpioPortFxn2); /* Enable interrupts */ GPIO_enableInt(MSP_EXP430F5529LP_RTC); GPIO_enableInt(Board_BUTTON0); GPIO_enableInt(Board_BUTTON1); /* Start BIOS */ BIOS_start(); return (0); }
With this code the original Button actions trigger an interrupt and I get output to the console from the 2 callback functions.
However the additional GPIO interrupt does not respond. I also note that the P2_0 shows 0v so I wonder if I am missing something in the pin setup?
Starting the GPIO Interrupt example System provider is set to SysMin. Halt the target to view any SysMin contents in ROV. Port2 Int 1, 2 Port2 Int 2, 2 Port1 Int 1, 1 Port1 Int 2, 1 Port1 Int 3, 1 Port1 Int 4, 1
I realise I am missing something here. I would welcome any suggestions.