2015-12-31 07:53 AM
I am using an STM32F407
I want to generate exactly 400 pulses on PE5 or PE6 with a 50% duty cycle.I believe PE5 can be connected to TIM9 CH1, and PE6 can be connected to TIM9 CH2I have the PWM code running and I have located the TIM Base/ counter example.QuestionsDo I need to use an interrupt or can I just load a counter with 400 and let it count down to zero and stop?Can I do this with one timer or do I need two timers?If I need two timers how do I synchronize them so I can get exactly 400 pulses?Thanks and Happy New Year.Barry #tim-counter2015-12-31 09:17 AM
Not sure if TIM9 has a ''Repetition Count'', but even so those are only 8-bit wide.
If the frequency isn't too high you should be able to count off 400 updates and turn the pulse(s) off easily enough. With one timer you can output two phase aligned output of the same period, but differing duty, if you want something more complicated than that then you'll need more than one timer.