AnsweredAssumed Answered

Problem configuring external interrupt for PE13, PE14

Question asked by yao.randy.001 on Nov 17, 2014
Latest reply on Nov 17, 2014 by Clive One
I want to configure an external interrupt for PE13 and PE14, but can't seem to do it. My below code worked with PA1,PA2 (single digit ports). Please help:


void EXTILine13_Config(void)
{
//@brief: Setup External Interrupt Line on PE13
//@param: void
//@note: not working EXTI13_IRQN cannot be setup
     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
     GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
     GPIO_Init(GPIOE, &GPIO_InitStructure);


     /* Connect EXTI Line13 to PE13 pin */
     SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource13);


     /* Configure EXTI Line13 */
     EXTI_InitStructure.EXTI_Line = EXTI_Line13;
     EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
     EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
     EXTI_InitStructure.EXTI_LineCmd = ENABLE;
     EXTI_Init(&EXTI_InitStructure);


     /* Enable and set EXTI Line3 Interrupt to the lowest priority */
     NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //?
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init(&NVIC_InitStructure);
}



void EXTI13_IRQHandler(void)
{
//@brief: Handles EXTI Line 13 IRQ (Switch between five states)
//@param: void
  if(EXTI_GetITStatus(EXTI_Line13) != RESET)
  {
     flag++;
     if(flag==2)
     {
               //Debugging only: IRQ Handler should not access hardware
          GPIOD->BSRRL = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
          flag = 1;
     }
     EXTI_ClearITPendingBit(EXTI_Line13);
  }
}

Outcomes