AnsweredAssumed Answered

Interrupt that will not expected

Question asked by lee.wonsoo on Apr 23, 2018
Latest reply on Apr 23, 2018 by lee.wonsoo

Hello,

- MCU : STM8L101K3

I am using Port A.2 for interrupt and Port D.2 for general gpio.

 

GPIO_Init(GPIOA,GPIO_Pin_2, GPIO_Mode_In_FL_IT);
EXTI_SetPinSensitivity(EXTI_Pin_2, EXTI_Trigger_Falling);
GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_Out_PP_High_Fast);

In my scenario, Port D.2 is changed input to output mode per every 1sec.

if(onesec)
{
   onesec = 0;
   GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_In_FL_No_IT); // all led off

   if(redled)
   {
      GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_Out_PP_High_Fast);
      GPIO_ResetBits(GPIOD, GPIO_Pin_2); // red led on
   }
   else if(blueled)
   {
      GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_Out_PP_High_Fast);
      GPIO_SetBits(GPIOD, GPIO_Pin_2); // blue led on
   }
   else //led off
   {
      // nothing.
   }
}

If this condition is redled, The EXTI2_IRQHandler that will not expected is called.

The Port A.2's hardware line is not interrupted in oscillscope.

Please know me why EXTI2_IRQHandler is called?

 

Thanks in advance.

Outcomes