AnsweredAssumed Answered

Interrupts are not occurring in order

Question asked by Manjunatha S on Apr 3, 2013
Latest reply on Apr 5, 2013 by malund.erik
Hi! All,
I have a reed switch based Wind Speed and wind direction sensor(anemometer), these two reed switches(one for wind speed and another for direction) are connected to pull ups so that it generates the digital pulse as the switches closes and opens. i configured two interrupts for each reed switches but i should get one interrupt at a time that is one contact closure  at a time and i am getting these in ossciloscope but i am not getting the one interrupt at a time rather i am getting same interrupt at two times. can any one tell me the what is the reason ? and to overcome this.
gpio initialization
 
void WS_Init_Wind_Sensors_Input()
{
  GPIO_InitTypeDef gpio_init_structure;
  EXTI_InitTypeDef exti_init ;
 
  /* Enable GPIO clocks */
  RCC_AHBPeriphClockCmd(WIND_SPEED_SENSOR_RCC_AHBPeriph | WIND_DIRECTION_SENSOR_RCC_AHBPeriph, ENABLE);
 
  gpio_init_structure.GPIO_Pin  = WIND_SPEED_SENSOR_GPIO_PIN;
  gpio_init_structure.GPIO_Mode = GPIO_Mode_IN;
  gpio_init_structure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  gpio_init_structure.GPIO_Speed = GPIO_Speed_40MHz;
  gpio_init_structure.GPIO_OType = GPIO_OType_PP;
 
  /* Initialise the GPIO accordingly */
  GPIO_Init(WIND_SPEED_SENSOR_GPIO_PORT, &gpio_init_structure);
 
  gpio_init_structure.GPIO_Pin  = WIND_DIRECTION_SENSOR_GPIO_PIN;
 
  /* Initialise the GPIO accordingly */
  GPIO_Init(WIND_DIRECTION_SENSOR_GPIO_PORT, &gpio_init_structure);
 
  /* The syscfg module is clocked */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
 
  /* The EXTI mux is on exti line RG_EXTI_PINSOURCE for this GPIO pin */
  SYSCFG_EXTILineConfig(WIND_SPEED_SENSOR_EXTI_PortSource,WIND_SPEED_SENSOR_EXTI_PinSource);
 
  /* The EXTI mux is on exti line RG_EXTI_PINSOURCE for this GPIO pin */
  SYSCFG_EXTILineConfig(WIND_DIRECTION_SENSOR_EXTI_PortSource,WIND_DIRECTION_SENSOR_EXTI_PinSource);
 
  EXTI_StructInit(&exti_init);
  exti_init.EXTI_Line = WIND_SPEED_SENSOR_EXTI_LINEx;
  exti_init.EXTI_LineCmd = ENABLE;
  exti_init.EXTI_Trigger = EXTI_Trigger_Falling;
  EXTI_Init(&exti_init);
 
   /*Enable the interrupt in the NVIC */
  INIT_NVIC_Enable_Peripheral_Interrupt(WIND_SPEED_SENSOR_EXTIx_IRQn,0,0);
 
  exti_init.EXTI_Line = WIND_DIRECTION_SENSOR_EXTI_LINEx;
  exti_init.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_Init(&exti_init);
  /*Enable the interrupt in the NVIC */
 INIT_NVIC_Enable_Peripheral_Interrupt(WIND_DIRECTION_SENSOR_EXTIx_IRQn,0,0);
 
}
 
//interrupt handler
 
void EXTI9_5_IRQHandler(void)
{
    if( (EXTI_GetITStatus(EXTI_Line9) == SET ))
   {
     
     EXTI_ClearITPendingBit(EXTI_Line9);
   USART_Send_String("TD>>>>>>>>>\r\n ");
 
   }
 
 
    if((EXTI_GetITStatus(EXTI_Line6) == SET ))
    {
    
        USART_Send_String("TS!!!!!!!!!!!!!!!!!\r\n ");
 
    }
 
 
 
}



Tanking you.

Attachments

Outcomes