AnsweredAssumed Answered

STM32VL EXTI

Question asked by delos_reyes.kristian on Feb 5, 2013
Latest reply on Feb 5, 2013 by delos_reyes.kristian
Hello Guys,

I am trying to play with EXTI of STM32VL but what seems to be the problem in this code why I can't make it work

01.int main(void)
02.{
03.   
04.  GPIO_InitTypeDef GPIO_InitStructure;
05.  EXTI_InitTypeDef EXTI_InitStructure;
06.  NVIC_InitTypeDef NVIC_InitStructure;
07.   
08.  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; 
09.  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
10.  GPIO_Init(GPIOA, &GPIO_InitStructure);
11.   
12. 
13.  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
14. 
15.  EXTI_InitStructure.EXTI_Line = EXTI_Line1;
16.  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
17.  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 
18.  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
19.  EXTI_Init(&EXTI_InitStructure);
20. 
21.  NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;
22.  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
23.  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
24.  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
25. 
26.  NVIC_Init(&NVIC_InitStructure);
27.     
28.  STM32vldiscovery_LEDInit(LED3);
29.  //STM32vldiscovery_PBInit(BUTTON_USER, BUTTON_MODE_EXTI); 
30.   
31.   
32.  while (1)
33.  {
34.  }
35.}


in the stm32f10x_it.c

void EXTI1_IRQHandler(void)
{
  if(EXTI_GetITStatus(EXTI_Line1) != RESET)
  {
    /* Toggle LED3 */
     STM32vldiscovery_LEDToggle(LED3);
 
    /* Clear the User Button EXTI line pending bit */
    EXTI_ClearITPendingBit(EXTI_Line4);
  }
}

Outcomes