2024-03-21 02:46 AM
I am using STM32G030F6P6TR controller,using cube IDE software.I am
using input capture direct mode for TIMER3 channel 2,I have signal coming
to the pin of this capture timer.I want to reset timer after capture has been triggered.The
document I am referring (Document name:STM32L4 TIMERS)mentions this as Clear On Capture Mode.
However while setting TIMER3 in this mode from device configuration tool that
is .ioc file,i am unable to find clear on capture option.
How do I clear this counter value once I receive capture event on input signal??
I want this timer to reset every time I get capture event(currently using risign edge of input
signal).
Right now this counter keeps counting and does not get reset when capture event is observed.
Do i need to clear any specific registers or can this be done from standard library functions or
.ioc file.
Any help is appreciated as I am new to ST controller.Thanks in advance.
2024-04-02 07:21 AM - edited 2024-04-02 07:22 AM
Hello @reipl,
One way to do this is to enable interrupt and manually reset the counter in ISR, by calling __HAL_TIM_SET_COUNTER(htim, 0);
it is also worth mentioning that there is the one pulse mode that automatically stop counting after a capture event, check dedicated paragraph in RM0454
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.