2022-01-04 11:33 PM
I want to generate N numbers of pulses at F frequency and 50% duty cycle for that application what is my timers mode setting is best? (PWM , OC)
after N pulse timer stop its out put
how can do it?
2022-01-05 01:40 AM
2022-01-05 07:35 AM
Include your chip number.
Some timers have a repetition counter which could be used for this.
But this is always possible using a chained timer configuration, with the master timer in one-shot mode with a duration of exactly the length of time you want and the slave generating the PWM signals.
2022-01-05 07:57 AM
STM32F030C8T6TR MCU
2022-01-05 10:21 AM
Factor the Prescaler and Period values
Frequency= APBCLK / ((Prescaler + 1) * (Period + 1))
Duty = (Period + 1) / 2 // 50/50 duty
Consider TIM1 or TIM8, these have repetition counts (8-bit)
And then fire in One-Shot mode
2022-01-05 01:36 PM
As Tesla DeLorean writes. Consider using Advanced Timer TIM1 in one-shot mode if 255 counts is enought for you. If not you can link two timers together
Timer A (slave) generate PWM with 50% duty cycle, and is gated by output from Timer B.
Timer B run as counter and counts update events from timer A (count your pulses).
Then you can set pulse frequency by setting Timer A period and pulse number by timer B Compare channel value. This configuration should overcome 255 pulse limit in simple solution with Advanced timer (TIM1).
2022-01-05 07:59 PM
my requirement is 3(gpio pins) channel pulse out put with different frequency & Pulses.
3timers use each timers any one channel as pulse output.
how can I do this without using master / slave timer if possible?
single basic timer pulse count in interrupt like this ?
2022-01-05 08:00 PM
can i do this using single basic timer pulse counting in interrupt if possible then how?
because i need 3-chanel with different frequency & pulse
3-timer use each timers any one channel as output.
2022-01-05 11:31 PM
How many pulses do you need generate in one sequence ? And what is your pulse width ? That information can limit some soulitons.
With STM32F030 you have four timers with repetition counter. TIM1, TIM15, TIM16, TIM17. Use them in one-shot mode if 255 pulses are enough for your application.
If you need more pulses, you can do it that way. Take one of the mentioned timers. Set repetition counter to 255. Enable interrupts from "update" event. Interrupt fires every time timer generate 255 pulses. Then you can count number of generated pulses. When will remain less then 2*255 pulses. Write new value to repetition counter, to match desired number of pulses. For example if you want to generate 1000 pulses your sequence will looks that: