Skip to main content
LMorr.3
Senior
April 7, 2022
Solved

Is it possible to use a timer to send a on-time-pulse PWM at a frequency of less than 1Hz?

  • April 7, 2022
  • 6 replies
  • 1609 views

For example, sending a 1.5second on-time pulse?  It would also be helpful to be able to set a delay before the pulse starts as well as the 'repetition' of the pulse. The TIMER1 does have the required features but not sure how to scale down the frequency to under 1Hz. Should I chain timers as master/slave to obtain the low frequency?

Thanks!

This topic has been closed for replies.
Best answer by LMorr.3

Solved! Thanks to your helpful answers, I was able to use TIM1 with the appropriate prescalers to get the pin output I required.

Thanks again,

6 replies

Tesla DeLorean
Guru
April 7, 2022

Typically TIM1 and TIM8 have a repetition could for sending pulse trains, via PWM / One-Shot

TIM2 and TIM5 are typically 32-bit, depends on what unspecified STM32 part you're using.

Long delays one might consider using SysTick, depends on criticality of the placement.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
LMorr.3
LMorr.3Author
Senior
April 7, 2022

Thanks. I'm currently using STM32F407 but could use any part that will do the job. I was thinking of using freeRTOS's software timers but the 'ticks' are 1ms which may not provide high enough frequency, or just barely. I was hoping I could do the pulse using one-time-pulse with repetition and delay features of TIMER1 which supports the repeat count.

waclawek.jan
Super User
April 7, 2022

> Should I chain timers as master/slave to obtain the low frequency?

If one timer can't provide the required period using its PSC and ARR, then yes, why not.

JW

TDK
Super User
April 7, 2022

> The TIMER1 does have the required features but not sure how to scale down the frequency to under 1Hz.

Why can't you do this with TIM1?

timer clock of 168MHz

clock divider of /4

prescaler of 65535

period of 65535

--> timer update frequency 168MHz/4/65536/65536 = 0.00978 Hz.

Should be plenty slow enough for your needs, no?

Could set the delay before the pulse by adjusting CCRx.

"If you feel a post has answered your question, please click ""Accept as Solution""."
S.Ma
Principal
April 8, 2022

Write down desired frequency and peruod. What tolerances? Is this period constant?

LMorr.3
LMorr.3AuthorBest answer
Senior
April 9, 2022

Solved! Thanks to your helpful answers, I was able to use TIM1 with the appropriate prescalers to get the pin output I required.

Thanks again,