Skip to main content
MGuil.1
Associate II
December 24, 2021
Question

How to restart counter of a timer

  • December 24, 2021
  • 2 replies
  • 780 views

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.

This topic has been closed for replies.

2 replies

TDK
Super User
December 24, 2021

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
MGuil.1Author
Associate II
December 24, 2021

Thank TDK, I gonna test that