cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with External Interrupt

raja81a
Associate II
Posted on August 23, 2014 at 09:13

Hello Sir,

I'm facing the problem with external interrupt while using debugger. I'm using PC14 as external input key and PA15 as normal input key. So,when I was using debugger if I pressed the normal key(PA15) it is activating the external interrupt which is connected to PC14. If I remove the debugger it's working fine. Please Tell me the solution.

#ask-smarter-questions #thanks-and-best-regards
2 REPLIES 2
Posted on August 23, 2014 at 12:50

Very little context to work with here, perhaps you can share some details about the STM32 chip in question, the board, toolchain/debugger, or perhaps some code fragments?

Both pins would share the same EXTI interrupt vector, you'd likely have to filler/qualify the source, and you should be able to differentiate between Line 14 and Line 15. If you poorly construct your IRQHandler it is possible that might re-enter in an undesirable fashion. The use of JTAG might also interfere with the pin use/configuration.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
raja81a
Associate II
Posted on August 25, 2014 at 07:35

I'm using STM32F030C6 controller and the debugger is ST-LINK/V2.

Comming to code

void EXTI14_Config(void)    //PC14

{

  EXTI_InitTypeDef   EXTI_InitStructure;

  GPIO_InitTypeDef   GPIO_InitStructure;

  NVIC_InitTypeDef   NVIC_InitStructure;

    

  /* Enable GPIOA clock */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

  /* Configure PC14 pin as input*/

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; 

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* Enable SYSCFG clock */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

      

  /* Connect EXTI14 Line to PC14 pin */

  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource14); //c

  /* Configure EXTI14 line */

  EXTI_InitStructure.EXTI_Line = EXTI_Line14; 

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

  EXTI_InitStructure.EXTI_LineCmd = ENABLE;

  EXTI_Init(&EXTI_InitStructure);

  /* Enable and set EXTI14 Interrupt */

  NVIC_InitStructure.NVIC_IRQChannel = EXTI4_15_IRQn;   //c

  NVIC_InitStructure.NVIC_IRQChannelPriority = 0x00;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

}

//Interrupt Handler

void EXTI4_15_IRQHandler(void)

{

  if(EXTI_GetITStatus(EXTI_Line14) != RESET)  //PC14    

  {        

            exti_flag = 1;

        

            /* Clear the EXTI line 14 pending bit */

            EXTI_ClearITPendingBit(EXTI_Line14);          

  }