cancel
Showing results for 
Search instead for 
Did you mean: 

Can I configure a Timer in center-aligned mode to start counting from a value other than 0?

aeren
Associate

Hi everyone,

I'm using an STM32 timer in center-aligned mode, and I would like the counter to start from a value other than zero. Specifically, I want the timer to count from a custom value (e.g., 2000), up to the auto-reload value (ARR), and then count down again, repeatedly — like a normal center-aligned operation, but starting from a value other than 0.

Is there a way to set the initial value of the counter before the counting starts, so that the up/down counting occurs between a custom starting point and the ARR value?

I’m aware that I can use __HAL_TIM_SET_COUNTER() to set the counter to a custom value, but I’m not sure how it behaves in center-aligned mode or whether it interferes with the timing or alignment.

Any ideas or suggestions would be greatly appreciated!

Thanks in advance.

1 REPLY 1
TDK
Guru

Yes, set the counter value prior to starting the counter and it will start from there.

For example:

TDK_0-1745435473355.png

 

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