cancel
Showing results for 
Search instead for 
Did you mean: 

IRQHandler and RTOS

esiqueira
Associate II
Posted on May 07, 2012 at 18:42

Hi,

I have a problem, because there are sensors signals a lot (at handler).

The signals arrive at the same time, and then, sometimes, the counters

don't stay the same each others, but I am simulating at the same signal.

I would like to know if I can do the Handler interrupt individually

of EXITI 10, 11, 12, 13, 14 and 15 or I have to do as the same below:

/*******************************************************************************

* Function Name  : EXTI15_10_IRQHandler

* Description    : This function handles External lines 15 to 10 interrupt request.

* Input          : None

* Output         : None

* Return         : None

*******************************************************************************/

void EXTI15_10_IRQHandler(void)

{

 /* Sensor 0 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line10) != RESET)

 {

  sinal_sensor0++;

  EXTI_ClearITPendingBit(EXTI_Line10); 

 }

 /* Sensor 1 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line11) != RESET)

 {

  sinal_sensor1++;

  EXTI_ClearITPendingBit(EXTI_Line11); 

 }

 /* Sensor 2 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line12) != RESET)

 {

  sinal_sensor2++;

  EXTI_ClearITPendingBit(EXTI_Line12); 

 }

 /* Sensor 3 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line13) != RESET)

 {

  sinal_sensor3++;

  EXTI_ClearITPendingBit(EXTI_Line13); 

 }

 /* Sensor 4 - Tratamento de Interrupcao */ 

 if(EXTI_GetITStatus(EXTI_Line14) != RESET)

 {

  sinal_sensor4++;

  EXTI_ClearITPendingBit(EXTI_Line14); 

 }

 /* Sensor 5 - Tratamento de Interrupcao */ 

 if(EXTI_GetITStatus(EXTI_Line15) != RESET)

 {

  sinal_sensor5++;

  EXTI_ClearITPendingBit(EXTI_Line15); 

 }

}

Thanks

Other Question....

The RTOS can help to solve this problem?????

#stm32-irqhandler-rtos
3 REPLIES 3
alok472
Associate II
Posted on May 08, 2012 at 03:26

What you are doing is correct. Single ISR for 5 INT. if you have problem in handling, shift them to other dedicated IOs P0 to 4 which have their own ISR.

I dont think RTOS can handle this either. 

esiqueira
Associate II
Posted on May 11, 2012 at 14:11

Actually I need of this dedicated IRQ and also IRQs[10...15] and IRQs[5...9]

What should be the solution? A time to wait until the reading of the last signal would be a good option?

/*******************************************************************************

* Function Name  : EXTI15_10_IRQHandler

* Description    : This function handles External lines 15 to 10 interrupt request.

* Input          : None

* Output         : None

* Return         : None

*******************************************************************************/

void EXTI15_10_IRQHandler(void)

{

 /* Sensor 0 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line10) != RESET)

 {

  tim_sensor0=5;      // 5ms

  sinal_sensor0++;

  EXTI_ClearITPendingBit(EXTI_Line10); 

 }

 /* Sensor 1 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line11) != RESET)

 {

  tim_sensor1=5;      // 5ms

  sinal_sensor1++;

  EXTI_ClearITPendingBit(EXTI_Line11); 

 }

 /* Sensor 2 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line12) != RESET)

 {

  tim_sensor2=5;      // 5ms

  sinal_sensor2++;

  EXTI_ClearITPendingBit(EXTI_Line12); 

 }

 /* Sensor 3 - Tratamento de Interrupcao */

 if(EXTI_GetITStatus(EXTI_Line13) != RESET)

 {

  tim_sensor3=5;      // 5ms

  sinal_sensor3++;

  EXTI_ClearITPendingBit(EXTI_Line13); 

 }

 /* Sensor 4 - Tratamento de Interrupcao */ 

 if(EXTI_GetITStatus(EXTI_Line14) != RESET)

 {

  tim_sensor4=5;      // 5ms

  sinal_sensor4++;

  EXTI_ClearITPendingBit(EXTI_Line14); 

 }

 /* Sensor 5 - Tratamento de Interrupcao */ 

 if(EXTI_GetITStatus(EXTI_Line15) != RESET)

 {

  tim_sensor5=5;      // 5ms

  sinal_sensor5++;

  EXTI_ClearITPendingBit(EXTI_Line15); 

 }

}

/*******************************************************************************

* Function Name  : TIM2_IRQHandler

* Description    : This function handles TIM2 global interrupt request.

* Time          : 1ms      

* Input          : None

* Output         : None

* Return         : None

*******************************************************************************/

void TIM2_IRQHandler(void)

{

  if(TIM_GetFlagStatus(TIM2, TIM_FLAG_Update) == SET)

  {

    if (tim_sensor0>0)

        tim_sensor0--;

    if (tim_sensor1>0)

        tim_sensor1--;

    if (tim_sensor2>0)

        tim_sensor2--;

    if (tim_sensor3>0)

        tim_sensor3--;

    if (tim_sensor4>0)

        tim_sensor4--;

    if (tim_sensor5>0)

        tim_sensor5--;

    TIM_ClearITPendingBit(TIM2, TIM_IT_Update);   // Clear UIF flag

  }

 

}

Posted on May 11, 2012 at 16:11

There are certainly more efficient ways to do the interrupt/count code, but I'm at a loss to how an RTOS would help here.

What speed is the processor running?

What is the frequency of the interrupts, and pulse widths?

If your rate is too high, you will saturate the processor.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..