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 中断不在 GPIO12上触发

Guru**** 2484615 points
Other Parts Discussed in Thread: CC3220SF, SYSCONFIG

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1253321/cc3220sf-launchxl-gpio-interrupt-does-not-trigger-on-gpio12

器件型号:CC3220SF-LAUNCHXL
主题中讨论的其他器件:CC3220SFSysConfig

大家好、我想在使用 CC3220SF Launchpad 时在 GPIO12/P3上触发中断。 我的目标是、一旦将引脚设置为接地、就会触发中断。 这是我在 SysConfig 上进行的设置

因此思路是在内部引脚连接到上拉电阻器、当我将引脚设置为接地时、会生成中断。 这是 SysConfig 通过 GUI 生成的配置

问题是该中断永远不会发生三态。 如果我在这里遗漏了一些东西、您可以提供建议吗? 我们使用的是 FreeRTOS

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Bilal:

    您的 syscfg 设置看起来不错。 您是否在应用中初始化了驱动程序? 我建议进行测试、以查看 SDK 中的 GPIO 中断示例是否按预期工作、然后开始在代码中实现该示例。

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

    此致、

    罗格利奥

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我已经这么做了、也不起作用、按钮中断可以工作、但一旦我将其更改为 GPIO12、它就会停止工作、附加后您可以找到 SysConfig 和我修改过的示例文件

    /*
     * 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);
    }
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您对此问题有任何更新吗?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Bilal:

    我无法重现您的问题。 P03 (GP12)确实会在我的板中触发中断。 请尝试以下代码

    *
     * 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);
    }
    

     当您将 P03接地时、这将打开或关闭红色 LED。 如果您在电路板中看不到这一点、请尝试使用另一个引脚、因为在这种情况下、这可能是硬件问题。

    我的 SysConfig 设置

    此致、

    罗格利奥

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Bilal:

    我看到您拒绝了答案、这是否意味着上述代码在您的 LaunchPad 上不起作用?

    罗格利奥