AnsweredAssumed Answered

external interrupt issue

Question asked by bejaoui.bechir on Jun 17, 2013
Latest reply on Oct 29, 2013 by huy.truong
Hi there 

I'm pretty new to stm world I'm trying to generate an external interruption by pushing the user button on a stm32f4 discovery dev board, I tried to implement the staf via the API provided with the discovery dev board, the program compiles well however if I put a break point inside the IRQ handler and try the program, it doesn't enter the IRQ handler scope when I press the user button 
Here is my code in the main.c 
#include "stm32f4xx.h"
 
//Define the gpio init structure
GPIO_InitTypeDef   GPIO_InitStructure;
NVIC_InitTypeDef   NVIC_InitStructure; //interruption vector structure
EXTI_InitTypeDef   EXTI_InitStructure;// ext interupt structure
RCC_ClocksTypeDef  RCC_ClockFreq; // the clock frequency structure
 
void main()
{
   
  /* Configure EXTI Line0 (connected to PA0 pin) in interrupt mode ********/
  /* Enable GPIOA clock */
   RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
  /* Enable SYSCFG clock */
   SYSCFG_CompensationCellCmd(ENABLE);
    
   /* Configure PA0 pin as input floating */
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
     
    /* Connect EXTI Line0 to PA0 pin via SYSCFG */
    SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
     
    /* Configure EXTI Line0 */
     EXTI_InitStructure.EXTI_Line = EXTI_Line0;
     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 Line0 Interrupt to the lowest priority */
     NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init(&NVIC_InitStructure);
 
     /* Output clock on MCO1 pin(PA8) and MCO2 pin (PC9)***********************/
     /* Enable GPIOC peripheral */
     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
                              
     /* Configure MCO1 pin(PA8) in alternate function */
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 
      GPIO_Init(GPIOA, &GPIO_InitStructure);                
       
      /* Configure MCO2 pin(PC9) in alternate function */
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 
       
      GPIO_Init(GPIOC, &GPIO_InitStructure);
 
      while(1){}
   
}
here us my code in the 
stm32f4xx_it.c 
void EXTI0_IRQHandler(void)
{
   int x = 2;
    
      
}


Outcomes