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.

CC3220SF-LAUNCHXL: GPio Interrupt does not trigger on Gpio12

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF, SYSCONFIG

Hi, I wanted to trigger an interrupt on gpio12/p3 while using CC3220SF launchpad. My goal is that interrupt is triggered as soon as pin is set to ground. here is the settings i did on sysconfig

so idea is that internal the pin is connected to pullup and when i set the pin to ground , an interrupt is generated. Here are the configuration generated by sysconfig

The problem is that interrupt is never trigerred. Can yoou suggest if i am missing something here. We are using Freertos

  • Hi Bilal,

    Your syscfg settings look ok. Did you initialize the driver in your application? I would recommend testing to see if the gpio interrupt example in the sdk works as expected, then start implementing the example into your code.

    https://dev.ti.com/tirex/explore/node?node=A__ANCoCv0X.3ABFns9Wk.Zsw__com.ti.SIMPLELINK_CC32XX_SDK__fc2e6sr__LATEST

    Kind Regards,

    Rogelio

  • Hi ,

    I already did, does not work either, the button interrupt works but as soon as i change it to gpio12, it stops working, attach you can find both sysconfig and example file i modified

    /*
     * Copyright (c) 2015-2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.c ========
     */
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    /*
     *  ======== gpioButtonFxn0 ========
     *  Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_0.
     *
     *  Note: GPIO interrupts are cleared prior to invoking callbacks.
     */
    //void gpioButtonFxn0(uint_least8_t index)
    //{
        /* Toggle an LED */
    //    GPIO_toggle(CONFIG_GPIO_LED_0);
    //}
    void GPIOintHandler(uint_least8_t index)
    {
        /* Toggle an LED */
        //GPIO_toggle(CONFIG_GPIO_LED_0);
        //LOG_INFO("Interrupt occured");
        GPIO_disableInt(GPIO_nPFO);
        GPIO_clearInt(GPIO_nPFO);
        PRCMHibernateCycleTrigger();
    
    }
    
    /*
     *  ======== gpioButtonFxn1 ========
     *  Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_1.
     *  This may not be used for all boards.
     *
     *  Note: GPIO interrupts are cleared prior to invoking callbacks.
     */
    //void gpioButtonFxn1(uint_least8_t index)
    //{
    //    /* Toggle an LED */
    //    GPIO_toggle(CONFIG_GPIO_LED_1);
    //}
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* Call driver init functions */
        GPIO_init();
    
        /* Configure the LED and button pins */
    
        //GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        //GPIO_setConfig(CONFIG_GPIO_LED_1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(GPIO_nPFO, GPIO_CFG_INPUT_INTERNAL | GPIO_CFG_IN_INT_FALLING | GPIO_CFG_PULL_UP_INTERNAL);
    
        /* Turn on user LED */
        //GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        /* Install Button callback */
        //GPIO_setCallback(CONFIG_GPIO_BUTTON_0, gpioButtonFxn0);
        GPIO_setCallback(GPIO_nPFO, GPIOintHandler);
    
        /* Enable interrupts */
        //GPIO_enableInt(CONFIG_GPIO_BUTTON_0);
        GPIO_enableInt(GPIO_nPFO);
    
        /*
         *  If more than one input pin is available for your device, interrupts
         *  will be enabled on CONFIG_GPIO_BUTTON1.
         */
        //if (CONFIG_GPIO_BUTTON_0 != CONFIG_GPIO_BUTTON_1) {
            /* Configure BUTTON1 pin */
        //    GPIO_setConfig(CONFIG_GPIO_BUTTON_1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    
        //    /* Install Button callback */
        //    GPIO_setCallback(CONFIG_GPIO_BUTTON_1, gpioButtonFxn1);
        //    GPIO_enableInt(CONFIG_GPIO_BUTTON_1);
        //}
    
        return (NULL);
    }
    

  • Hi,

    Do you have any update on the issue Slight smile

  • Hi Bilal,

    I wasnt able to recreate your issue. P03 (GP12) does trigger an interrupt in my board. Try out the following code

    *
     * Copyright (c) 2015-2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.c ========
     */
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    /*
     *  ======== gpioButtonFxn0 ========
     *  Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_0.
     *
     *  Note: GPIO interrupts are cleared prior to invoking callbacks.
     */
    void gpioButtonFxn0(uint_least8_t index)
    {
        /* Toggle an LED */
        GPIO_toggle(CONFIG_GPIO_LED_0);
    }
    
    /*
     *  ======== gpioButtonFxn1 ========
     *  Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_1.
     *  This may not be used for all boards.
     *
     *  Note: GPIO interrupts are cleared prior to invoking callbacks.
     */
    void gpioButtonFxn1(uint_least8_t index)
    {
        /* Toggle an LED */
        GPIO_toggle(CONFIG_GPIO_LED_1);
    }
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* Call driver init functions */
        GPIO_init();
    
        /* Configure the LED and button pins */
        GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(CONFIG_GPIO_LED_1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        GPIO_setConfig(CONFIG_nPFO, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
        GPIO_setConfig(CONFIG_GPIO_BUTTON_0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    
        /* Turn on user LED */
        GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        /* Install Button callback */
        GPIO_setCallback(CONFIG_GPIO_BUTTON_0, gpioButtonFxn0);
    
        GPIO_setCallback(CONFIG_nPFO, gpioButtonFxn0);
    
        /* Enable interrupts */
        GPIO_enableInt(CONFIG_GPIO_BUTTON_0);
        GPIO_enableInt(CONFIG_nPFO);
    
        /*
         *  If more than one input pin is available for your device, interrupts
         *  will be enabled on CONFIG_GPIO_BUTTON1.
         */
        if (CONFIG_GPIO_BUTTON_0 != CONFIG_GPIO_BUTTON_1) {
            /* Configure BUTTON1 pin */
            GPIO_setConfig(CONFIG_GPIO_BUTTON_1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    
            /* Install Button callback */
            GPIO_setCallback(CONFIG_GPIO_BUTTON_1, gpioButtonFxn1);
            GPIO_enableInt(CONFIG_GPIO_BUTTON_1);
        }
    
        return (NULL);
    }
    

    This will turn on or off the red LED when you connect P03 to ground. If you do not see that in your board try to use another pin as it could be a hardware issue in that case.

    My Sysconfig settings

    Kind Regards,

    Rogelio

  • Hi Bilal,

    I saw you rejected the answer, does this mean the code above not work on your launchpad?

    Rogelio