Skip to main content
yang hong
Associate III
October 14, 2020
Question

timer

  • October 14, 2020
  • 3 replies
  • 608 views

I am using NUCLEO-H743ZI2. I am trying timer to generate pulse using TIM_OCMODE_TOGGLE channel 1. my timer clock is 100MHz, I set pre-scaler as 9 and channel 1 pulse as 9 as well. It seems it is difficult to get pulse, except I add more count on channel 1. is it true?

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
October 14, 2020

You have to set the respective CCRx register to below value you've set into ARR, otherwise there is no compare thus no toggling. Prescaler (PSC) has nothing to do with this fact, it only influences the output frequency of toggling.

JW

TDK
Super User
October 14, 2020

To get a pulse, you need to set the period and the pulse value. For 50% duty cycle, set pulse = (period + 1) / 2.

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
October 15, 2020

Just to avoid any confusion: TDK talks about PWM mode.

TOGGLE mode results always on 50% duty and half the frequency of timer's overflow frequency.

JW