AnsweredAssumed Answered

handling multiple interrupts on same EXTI line in STM32

Question asked by afzal.uzair on Dec 12, 2012
Latest reply on Dec 19, 2012 by afzal.uzair
I am doing a project using STM32F103. I have a scenario. I want to use PG1 and PF1 pins as falling edge interrupt pins which are on same EXTI1 line. Problem is that only one pin which is configured after first one using GPIO_EXTILineConfig() function, which is PF1 in my below code, is correctly going to ISR while PG1 is not going to ISR on interrupt at all. If I configure PG1 after PF1  using GPIO_EXTILineConfig() function
 then only PG1 goes to ISR. What is wrong? How to handle 2 or more interrupts on same EXTI line? Also please tell can I configure PG1 on rising edge interrupt and PF1 on falling edge at same time? My code is:

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOG, &GPIO_InitStructure);


GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOF, &GPIO_InitStructure);

GPIO_EXTILineConfig(GPIO_PortSourceGPIOG,GPIO_PinSource1);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOF,GPIO_PinSource1);

// Configure EXTI1 line 
  EXTI_InitStructure.EXTI_Line = EXTI_Line1;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;  
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
  NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x07;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

void EXTI1_IRQHandler(void)
{
     if(EXTI_GetITStatus(EXTI_Line1) != RESET)
     {

          /*   my implementation of ISR */

          EXTI_ClearITPendingBit(EXTI_Line1);
     }
}

Outcomes