AnsweredAssumed Answered

Reset TIM counter on external signal edge?

Question asked by kostka.tim on Jan 7, 2016
Latest reply on Jan 7, 2016 by kostka.tim
I'm using a timer in PWM mode to create a clock source.  I'd like to be able to reset that timer so that the TIM edges coincide with an external (asynchronous) source.  If there is no edge on the external source, I still want the timer to continue at its predefined frequency.

Now, obviously there are a few ways to do this.  The easiest is probably using an EXTI interrupt and resetting the counter to 0 on an external clock edge.  However, the external source is pretty high frequency (~3Mhz), so using that method would take up a prohibitive amount of CPU resources.  Is there a way to trigger the timer to reset when the TIM1_ETR pin goes low that doesn't take up CPU cycles?

For example, I'd like the rising edge on 10 to reset the PWM signal on 11 so the edges coincide (within a clock cycle or two).

 timer_edge_trigger.png

From looking in the documentation, it is not clear, but there was enough to suggest it may be possible.

Using a STM32F405 chip and the TIM1 timer, if it matters.

Many thanks,
Tim

Outcomes