AnsweredAssumed Answered

GPIO Interrupt Issue

Question asked by asl.sean on Feb 23, 2013
Latest reply on Feb 26, 2013 by jj.sprague
Hi , 

I am using the following code to configure my external interrupt on PH10 , PH11, PH12.

However , the interrupt does not occur when a signal is applied to PH10 , bothe PH11 and PH12 is working fine .

Is there something i missed out ?


    GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef   EXTI_InitStructure;
 
/* GPIOH clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOH, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
 
/* TIMER channel 1 pin (PA1) configuration */
GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_10 |GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOH, &GPIO_InitStructure);
 
/* Connect EXTI Interrupt Pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOH, EXTI_PinSource10);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOH, EXTI_PinSource11);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOH, EXTI_PinSource12);
 
/* Configure EXTI Line */
 
EXTI_InitStructure.EXTI_Line = EXTI_Line10;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
 
 
EXTI_InitStructure.EXTI_Line = EXTI_Line11 ;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
 
EXTI_InitStructure.EXTI_Line = EXTI_Line12 ;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
 
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
void EXTI15_10_IRQHandler(void) {
 
    if(EXTI_GetITStatus(EXTI_Line10) != RESET){
 
        EXTI_ClearITPendingBit(EXTI_Line10);
        if (activeChannel == 1)
            channel1Count++;
    }
 
    else if(EXTI_GetITStatus(EXTI_Line11) != RESET){
 
        EXTI_ClearITPendingBit(EXTI_Line11);
        if (activeChannel == 2)
            channel1Count++;
    }
 
    else if(EXTI_GetITStatus(EXTI_Line12) != RESET){
 
        EXTI_ClearITPendingBit(EXTI_Line12);
        if (activeChannel == 3)
            channel1Count++;
    }
 
}

Outcomes