今天自己写了一下例程中的实验5,外部中断实验(库函数版),在设置IO口复用的时候发现,PA0口作为外部中断时不开启复用时钟,也可以正常进入中断,但是其他的IO口(PE2,3,4)不开启复用时钟就进不去中断,我写的EXTI初始化代码如下,并且我将战舰开发板例程里的PA0口的GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource0);注释掉之后程序也可以完美运行,其他的IO口GPIO_EXTILineConfig注释掉就不行了,看了STM32中文参考手册也没找到问题所在,有知道的能不能告诉下原因。
[mw_shl_code=c,true]void exit_init(void)
{
EXTI_InitTypeDef EXIT_InitStructure;
GPIO_Config();
EXIT_InitStructure.EXTI_Line = EXTI_Line0 ;
EXIT_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXIT_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXIT_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXIT_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource2);
EXIT_InitStructure.EXTI_Line = EXTI_Line2;
EXIT_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXIT_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXIT_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXIT_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource3);
EXIT_InitStructure.EXTI_Line = EXTI_Line3;
EXTI_Init(&EXIT_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource4);
EXIT_InitStructure.EXTI_Line = EXTI_Line4;
EXTI_Init(&EXIT_InitStructure);
}[/mw_shl_code]
|