cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI does not trigger/fire Please help!

siddharth12345
Associate II
Posted on August 21, 2012 at 12:11

Hello All,

I have configured an user button(connected to PG15) on the evaluation board(MCBSTM32F200) to generate an interuppt when pressed. The GPIO is iniztialized and works fine however the IRQ handler is never entered. Could someone please help me. The code is as below.

void Exti_Config(void)

{

GPIO_InitTypeDef GPIO_InitStructure;  

EXTI_InitTypeDef EXTI_InitStructure;

NVIC_InitTypeDef NVIC_InitStructure;

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);  // clock to the GPIO

GPIO_InitStructure.GPIO_Pin  = GPIO_Pin_15;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;

GPIO_Init(GPIOG, &GPIO_InitStructure);

                                                                            

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOG,EXTI_PinSource15);

  EXTI_InitStructure.EXTI_Line = EXTI_Line15;

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;  

  EXTI_InitStructure.EXTI_LineCmd = ENABLE;

  EXTI_Init(&EXTI_InitStructure);

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);

  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

}

/*Interupt routine which checks if the user button is pressed*/  

void EXTI15_10_IRQHandler(void) 

{

if(EXTI_GetITStatus(EXTI_Line15) != RESET)

{

GLCD_DisplayString (LCD_LINE_NUMBER_7, LCD_COLUMN_NUMBER_16, FONT_INDEX_1,''Xsas'');

}

EXTI_ClearITPendingBit(EXTI_Line15);

}
4 REPLIES 4
siddharth12345
Associate II
Posted on August 21, 2012 at 14:22

The Button/key connected to PG15 is a pull down. Forgot to add this in my previous post.

Thanks in advance

Posted on August 21, 2012 at 14:39

  /* Enable SYSCFG clock */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

Also verify you have got the vector table correctly built and situated, that the names match, and you have correct linkage.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
siddharth12345
Associate II
Posted on August 21, 2012 at 14:56

Thanks for this clive.

I was using multiple buttons to set off interuppts & got stuck at a point where EXTI1_IRQ was getting triggered without even a button press. Dont know what the reason was, hence got confused. Now i have configured that button to a different EXTI_IRQ.

Thanks again.

siddharth12345
Associate II
Posted on August 21, 2012 at 15:11

Also can i configure two buttons to generate an interuppt(using EXTI) on the same lines?