cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt that will not expected

leewonsoo
Associate
Posted on April 23, 2018 at 03:59

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.

0690X0000060AjPQAU.png

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

Please know me why 

EXTI2_IRQHandler is called?

Thanks in advance.

2 REPLIES 2
Szymon PANECKI
Senior III
Posted on April 23, 2018 at 11:03

Hello,

EXTI controller is designed is a way, that EXTI[number] is connected to all Px[number] pins. This means that EXTI2 IRQ handler will react on signal change on very pin, which has 2 in the name: PA2, PB2, PC2 andPD2. Pleas see below the extract from MCU's reference manual.

0690X0000060AjKQAU.png

I believe that this could be an explanation of the bahavior, that you faced.

Regards

Szymon

Posted on April 23, 2018 at 11:37

 ,

 ,

Thanks.

I have one more question.

In output mode, level change is not affects to same interrupt's pin ♯ .

What is the exact meaning of the signal change? ,

Regards

leewonsoo