Problem configuring external interrupt for PE13, PE14
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-11-17 10:08 AM
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); }}
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-11-17 10:22 AM
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..
Up vote any posts that you find helpful, it shows what's working..
