cancel
Showing results for 
Search instead for 
Did you mean: 

How to restart counter of a timer

MGuil.1
Associate II

Hello All,

I'm using a STM32H743, and I would like on runtime from a GPIO IT, restart to zero the counter period of a timer, is it possible ?

How to do that ? I havn't found API for that.

Thanks.

2 REPLIES 2
TDK
Guru

The counter register can be directly accessed and modified.

TIM1->CNT = 0;

Or if you really want to use HAL:

__HAL_TIM_SET_COUNTER(&htim1, 0);

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

Thank TDK, I gonna test that