Skip to main content
Senior III
April 14, 2026
Solved

Can I write to the TIMx_CNT register during Center-aligned PWM ?

  • April 14, 2026
  • 3 replies
  • 370 views

I am generating a PWM signal using timer1 register and use it in Center aligned mode. I want to to know if i can modify the timer counter register TIMx_CNT register with some "x" value in the timer interrupt instead of resetting it to 0. 

Best answer by Gyessine

Hello @STuser2 
It should be possible.
Here is a project that writes the CNT register of TIM6 after the first interrupt occurs to change the period from 10 seconds to 5 seconds.
You can use it as an example.
BR
Gyessine

3 replies

TDK
Super User
April 14, 2026

Yes, you can change the CNT register value at any time. It will affect your PWM signal.

"If you feel a post has answered your question, please click ""Accept as Solution""."
GyessineBest answer
Technical Moderator
April 15, 2026

Hello @STuser2 
It should be possible.
Here is a project that writes the CNT register of TIM6 after the first interrupt occurs to change the period from 10 seconds to 5 seconds.
You can use it as an example.
BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
STuser2Author
Senior III
April 16, 2026

Yes i was able to update and get it working but only in the up counting mode not in Center Aligned mode, is there any method i can follow so that the counter counts from some "X" value to ARR and from ARR to "X" value.

 

STuser2Author
Senior III
April 17, 2026

Could you please provide comment if it is possible in center aligned mode or not? 

TDK
Super User
April 17, 2026

Counters cannot count from X to ARR unless X is 0.

"If you feel a post has answered your question, please click ""Accept as Solution""."