cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Timer Triggers on the Fly...

jason2
Associate II
Posted on November 07, 2013 at 18:17

I have designed a variable pulse generator using the STM32F4 and using 7 timers which outputs on three pins, using AF pin couplings to TIM1/TIM8/TIM9(all operated in OPM mode) because I wanted the 6ns resolution provided by their 168Mhz clocks.

Here is how I have my setup:

TIM2 is MASTER and provides the main frequency to three SLAVE timers TIM3, TIM4, and TIM5, these three SLAVES and then MASTERS to TIM1, TIM8, and TIM9.

So:

TIM2(frequency)->TIM3(phase control)->TIM9(pulse width control)(to AF pin)

TIM2(frequency)->TIM4(phase control)->TIM1(pulse width control)(to AF pin)

TIM2(frequency)->TIM5(phase control)->TIM8(pulse width control)(to AF pin)

So, as you can see, I need everything to be IN SYNC, and I need to have a main frequency, and I need to have phase control so I can operate the three outputs ideally with 120d phase control, and I need pulse width control which is variable to each of the outputs.

SO...

To my main question then...

Is there anyway to have all of that which I have listed above with less timers?

One way I thought of was using one main timer as master and having three slave timers hooked to AF pin outputs and being able to change ON THE FLY the TRGO output for the main timer, is this possible?

Like being able to change from OC1Ref to OC2Ref to OC3Ref and back again, on the fly?

Thanks!

#stm32-stm32f4-timers-trgo
1 REPLY 1
jason2
Associate II
Posted on November 07, 2013 at 20:28

Just as fyi...

I did try to use a singular timer like TIM2 and used three OC channels and hence three interrupt routines wherein I ENABLED the three timers TIM1/8/9 in OPM mode, but the timing is way off, probably because of the delays in clock cycles doing the interrupts or something.

Thanks!