cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple GPIO Interrupts

shrum
Associate
Posted on March 31, 2014 at 02:29

Hello,

I am trying to activate the interrupts on PC4-7 so that a flag will appear whenever these pins are set high. I have the base structure of the code completed, however whenever I try to place a break point to see if the first interrupt (on PC4)  is working, I get the error ''Operation not possible while the target deice is executing. Please stop the target to preform this operation.'' I'm guessing that this is because this interrupt constantly setting its flag, but I do not understand why.

The other interrupts on PC5-7 seem to work fine, though they do activate their interrupts whenever the signal changes, not just on a rising or falling edge.

Do you know what could be causing the error message?

Here is my Interrupt Handler and Initializer function for Interrupts on GPIO4-7: 

void EXTI4_15_IRQHandler(void)

{

  if(EXTI_GetITStatus(EXTI_Line4) != RESET)

  {

EXTI_ClearITPendingBit(EXTI_Line4);

Leak_detected(1);

  }

if(EXTI_GetITStatus(EXTI_Line5) != RESET)

  {

EXTI_ClearITPendingBit(EXTI_Line5);

Leak_detected(2);

  }

if(EXTI_GetITStatus(EXTI_Line6) != RESET)

  {

EXTI_ClearITPendingBit(EXTI_Line6);

Leak_detected(3);

  }

if(EXTI_GetITStatus(EXTI_Line7) != RESET)

  {

EXTI_ClearITPendingBit(EXTI_Line7);

Leak_detected(4);

  }

}

void EXTI_Config(void)

{

  EXTI_InitTypeDef   EXTI_InitStructure;

  GPIO_InitTypeDef   GPIO_InitStructure;

  NVIC_InitTypeDef   NVIC_InitStructure;

  

  /* Enable GPIOC clock */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

  /* Configure PC4-7 pin as input floating */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* Enable SYSCFG clock */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  

  /* Connect EXTI0 Line to PC4-7 pin */

  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource4);

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource5);

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource6);

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource7);

  /* Configure EXTI0 line */

  EXTI_InitStructure.EXTI_Line = EXTI_Line4|EXTI_Line5|EXTI_Line6|EXTI_Line7;

  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 EXTI0 Interrupt */

  NVIC_InitStructure.NVIC_IRQChannel = EXTI4_15_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPriority = 0x00;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

}

Thanks!
1 REPLY 1
Posted on March 31, 2014 at 03:52

No I think it just wants you to stop the code in the debugger first. Alternatively after you have done the ''Run to main()'' thing, set the break-points before making it run/go

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..