cancel
Showing results for 
Search instead for 
Did you mean: 

Dual Interrupts from single UEV on TIM1 (STM32f103 )

robertpettersson9
Associate II
Posted on March 29, 2010 at 15:27

Dual Interrupts from single UEV on TIM1 (STM32f103 )

4 REPLIES 4
kamputty
Associate II
Posted on May 17, 2011 at 13:45

Are you clearing the interrupt at the ''start'' of the ISR or at the ''end''?

For example, in my TIM ''Hello world'', I use this...

void TIM2_IRQHandler()

{

    TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

    // toggle bit

    GPIOC->ODR ^= GPIO_Pin_12;

}

If you're clearing it at the ''end'', maybe it's calling the ISR again (the double) before it gets the clear bit set...

Posted on May 17, 2011 at 13:45

void TIM2_IRQHandler()

{

    if (TIM_GetITStatus(TIM2, TIM_IT_Update) == SET)

    {

        TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

        // toggle bit

        GPIOC->ODR ^= GPIO_Pin_12;

    }

}

>>If you're clearing it at the ''end'', maybe it's calling the ISR again (the double) before it gets the clear bit set...

You'd have to be doing a lot of stuff, but it will have longer to clear before exiting and being checked again.

Perhaps the better way to attack this is to see which of the 8 interrupts is pending, and make sure that they are ALL cleared. If interrupts aren't cleared on the STM32 you basically get a crap storm of interrupts and it won't execute any user space code.

-Clive
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
robertpettersson9
Associate II
Posted on May 17, 2011 at 13:45

Gentlemen, thanks a lot!!!

You were right, the ISR was called multiple times due to my clearing of the IRQ in the end of my code.

I discovered it also when I unintentionally forgot to clear the IRQ, then I got a crazy amount of calls to my ISR, but at the time I couldnt fully understand it.
robertpettersson9
Associate II
Posted on May 17, 2011 at 13:45

Problem solved!