Skip to main content
Senior III
Apr 14, 2026 10:57 AM UTC
Solved

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

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. 

Gyessine
GyessineBest answer
ST Technical Moderator
Apr 15, 2026 10:11 AM UTC

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.

5 replies

TDK
Apr 14, 2026 1:01 PM UTC

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""."
Gyessine
GyessineBest answer
ST Technical Moderator
Apr 15, 2026 10:11 AM UTC

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
STuser2Author
Senior III
Apr 16, 2026 2:52 AM UTC

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
Apr 17, 2026 5:17 AM UTC

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

TDK
Apr 17, 2026 1:04 PM UTC

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""."