2011-12-16 10:19 AM
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 #doh2011-12-16 10:33 AM
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.2011-12-16 10:50 AM
Yeah I was not incrementing the CCR register.
Not sure how I missed that minor detail.....Thanks.