cancel
Showing results for 
Search instead for 
Did you mean: 

Problem configuring external interrupt for PE13, PE14

randyao12345
Associate II
Posted on November 17, 2014 at 19:08

I want to configure an external interrupt for PE13 and PE14, but can't seem to do it. My below code worked with PA1,PA2 (single digit ports). Please help:

void EXTILine13_Config(void)

{

//@brief: Setup External Interrupt Line on PE13

//@param: void

//@note: not working EXTI13_IRQN cannot be setup

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;

GPIO_Init(GPIOE, &GPIO_InitStructure);

/* Connect EXTI Line13 to PE13 pin */

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource13);

/* Configure EXTI Line13 */

EXTI_InitStructure.EXTI_Line = EXTI_Line13;

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 EXTI Line3 Interrupt to the lowest priority */

NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //?

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

}

void EXTI13_IRQHandler(void)

{

//@brief: Handles EXTI Line 13 IRQ (Switch between five states)

//@param: void

  if(EXTI_GetITStatus(EXTI_Line13) != RESET)

  {

flag++;

if(flag==2)

{

//Debugging only: IRQ Handler should not access hardware

GPIOD->BSRRL = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;

flag = 1;

}

EXTI_ClearITPendingBit(EXTI_Line13);

  }

}
1 REPLY 1
Posted on November 17, 2014 at 19:22

void EXTI15_10_IRQHandler(void) // They all go here, and you filter your source(s)

{

...

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