PC3做为外部中断,管脚定义如下:
GPIO_InitStruct.Pin = TOUCH_INT_PIN;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
LL_GPIO_Init(TOUCH_INT_PORT, &GPIO_InitStruct);
LL_SYSCFG_SetEXTISource(TOUCH_EXTI_PORT, TOUCH_EXTI_SOUR);
EXTI_InitStruct.Line_0_31 = TOUCH_WAKE_LINE;
EXTI_InitStruct.Line_32_63 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING;
LL_EXTI_Init(&EXTI_InitStruct);
NVIC_SetPriority(TOUCH_WAKE_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));
NVIC_EnableIRQ(TOUCH_WAKE_IRQn);
中断响应函数:
void EXTI3_IRQHandler(void)
{
if (LL_EXTI_IsActiveFlag_0_31(TOUCH_WAKE_LINE) != RESET)
{
printf("touch wake\r\n");
LL_EXTI_ClearFlag_0_31(TOUCH_WAKE_LINE);
}
}
当MCU没有进入休眠时,外设动作能收到中断,打印touch wake
当MCU进入stop2模式后,外设动作(通过示波器看到有中断信号)不能进入EXTI3_IRQHandler。
请问是什么原因?谢谢 |