外部电路中断信号通过 GPIO 接入 MSP432P401Y,按例子程序做了如下配置:
GPIO_setConfig(BRD_GPIO_MPA, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
GPIO_setCallback(BRD_GPIO_MPA, IsrMPA);
GPIO_enableInt(BRD_GPIO_MPA);
调试过程中始终无法进入中断回调函数 IsrMPA,示波器可以测量到硬件信号下降沿。
BRD_GPIO_MPA 对应 P4.7,观察 MCU 内部寄存器:
P4DIR = 0x7F; P4REN = 0x80; P4OUT=0xBB // 说明 P4.7 配置为输入带上拉电阻
P4IE = 0x80 //说明 P4.7 中断使能
P4IES = 0xFE //说明 P4.7 是下降沿触发中断
文档还提到:
When the device operates in any power mode other than low-power modes LPM3, LPM4,
and LPMx.5, the interrupt capability is available only when the PxSEL1 and PxSEL0 bits are
0 for the corresponding interrupt capable I/Os.
所以,在 Power_init 使用的 PowerMSP432_config 中设置 .enablePolicy = false, 使得 MCU 一直保持在 Active 状态。
同时也确认了 P4SEL0 = 0 和 P4SEL1 = 0
但是外部信号的下降沿出现后,P4IFG一直等于 0x40,即 P4.7 没有触发中断,不知是什么缘故?请熟悉 MSP432P401Y 的高手解答一下,衷心感谢!