Skip to main content
jmorton
Associate
December 16, 2011
Question

CC Timer Interrupt (STM32F102RBT6)

  • December 16, 2011
  • 2 replies
  • 1183 views
Posted on December 16, 2011 at 19:19

Using a general purpose timer (TIM3), with a constant frequency I would like to be able to occasionally generate an interrupt on CC3 using a variable count for CCR3.  

I do not want to generate a PWM signal or change the state of the output.  I just would like to use the CC3 interrupt simply for timing.

I have the timer base for TIM3 configured as desired, but can't correctly setup the CC3 channel.

My interrupt (TIM_IT_CC3) is firing when TIM3 rolls over, not when the CCR3 value is reached.

Using the driver, I have set the mode to TIM_OCMode_Timing and then set the pulse value to my desired time interval.

What am I missing?

Thanks.

#timer #interrupt #tim #doh
This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
December 16, 2011
Posted on December 16, 2011 at 19:33

Seems like a reasonably viable method, along the lines of the example

\STM32F10xFWLib\Examples\TIM\TimeBase\main.c

The example makes the assumption of a full 16-bit count, and keeps advancing the various CCR values and toggling GPIO to demonstrate the interrupts working.

You'd have to make sure you didn't advance the CCR value beyond the period of the counter if you had a shorter count.

Maybe you fell down in the implementation, but I have nothing to go on.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
jmorton
jmortonAuthor
Associate
December 16, 2011
Posted on December 16, 2011 at 19:50

Yeah I was not incrementing the CCR register.

Not sure how I missed that minor detail.....

Thanks.