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.

[参考译文] CC2652R7:即使中断被禁用、GPIO 也会发生中断。

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1228530/cc2652r7-gpio-interrupt-occur-even-though-interrupt-are-disabled

器件型号:CC2652R7

启用特定引脚的中断(索引14),当该中断发生时,回调函数会禁用特定引脚的中断 (索引14)。

但是、即使在  中断被禁用后、该中断仍会发生。

此引脚与开关相连。

我设计为在按下开关时生成一个中断。

有时会出现此问题。


我实现了以下内容来禁用中断。

void callback_function (uint_least8_t 引脚)

  GPIO_disableInt (14);
}

该 callback_function 是注册给 GPIO_setCallback 的函数、

在发生中断时调用此函数。

我在发生中断后检查了变量(pin)、pin 为14。

此外、IOCFG 的 EDGE_IRQ_EN 为0 (无中断生成)。

如果我做错了什么、或者错过了禁用中断的方法、敬请告知。
或者如果有其他原因、请告诉我。


simplelink_cc13xx_cc26xx_sdk_5_30_01_01

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

    尊敬的 Satoshi:

    这是 GPIO TI 驱动程序运行时 API。  我建议您 在 call_function 的上下文之外使用 GPIO_disableInt 和 GPIO_clearInt 、因为在中断提供服务时禁用中断可能会导致问题。  另外、您是否还尝试过使用  GPIO_setConfig 或 GPIO_setInterruptConfig 禁用中断?  您还可以调试应用程序寄存器以确认 IOC:IOCFG14:EDGE_IRQ_EN 已关闭。

    此致、
    Ryan

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

    您好、Ryan-San、

    感谢您的回答。

    我还没有尝试使用 GPIO_setConfig 或 GPIO_setInterruptConfig、因此我会尝试使用 GPIO_setInterruptConfig。

    我将尝试像这样实施它。
    void callback_function (uint_least8_t 引脚)

      GPIO_setInterruptConfig (14、GPIO_CFG_INT_DISABLE);
    }

    是否可以在 callback_function 中调用此 API?

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

    您可以参考 project_zero 中 GPIO_Board_keyCallback 中的 GPIO_setConfig 用法示例:

    static void GPIO_Board_keyCallback(uint_least8_t index)
    {
        Log_info1("Button interrupt: %s",
                  (uintptr_t)((index == CONFIG_GPIO_BTN1) ? "Button 0" : "Button 1"));
    
        // Disable interrupt on that gpio for now. Re-enabled after debounce.
        GPIO_setConfig(index, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INT_DISABLE);
    
        // Start debounce timer
        switch(index)
        {
        case CONFIG_GPIO_BTN1:
            Util_startClock((Clock_Struct *)button0DebounceClockHandle);
            break;
        case CONFIG_GPIO_BTN2:
            Util_startClock((Clock_Struct *)button1DebounceClockHandle);
            break;
        }
    }

    因此、这种实施方式应该是可以接受的。

    此致、
    Ryan