cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 timer compare match interrupt while downcounting

sarhangpour
Associate II
Posted on November 05, 2014 at 11:58

Hi,

Consider this situation:

TimerX is counting down from 1000 to 0 and it will up-count from 0 to 1000 afterwards (center aligned PWM).

If I set a CC to something like 200, and enabled CC interrupt, the interrupt would happen when the timer was upcounting from 0 to 1000 and it crosses 200. 

But... I want an interrupt while it's down counting, in other words, when it's going from 201 to 200. Not when it's counting up from 199 to 200.

Is there any solutions?

Thanks
1 REPLY 1
sirpak
Associate II
Posted on May 07, 2015 at 13:37

I think there are three different center aligned strategies:

The Output compare interrupt flag of channels configured in output is set when: the

counter counts down (Center aligned mode 1, CMS = ''01''), the counter counts up (Center aligned mode 2, CMS = ''10'') the counter counts up and down (Center aligned mode 3,

CMS = ''11'').