Skip to main content
SCamp.1041
Associate III
Aug 26, 2025 9:53 PM UTC
Question

Is there a way to reset the internal prescaler counter in input capture mode?

My timer setup in input capture mode. The ICPrescaler value is set to TIM_ICPSC_DIV2, meaning a capture event will occur on the falling edge of every second pulse.
 
I need to handle an edge case where I need to "reset" the whole input capture system. If I need to handle a reset in-between the first and second triggers, then the internal prescaler counter will be at 1 when I reset/reconfigure, and then the very next input edge will trigger a capture instead of waiting for the full prescaler count of 2
 
 
In order to handle this edge case I need a way to "reset" the internal prescaler counter, however I don't think there is a HAL function to do this.
This topic has been closed for replies.

4 replies

TDK
Aug 26, 2025 11:52 PM UTC

There's always the nuclear option:

__HAL_RCC_TIMx_FORCE_RESET();
__HAL_RCC_TIMx_RELEASE_RESET();

You can try disabling/reenabling the timer but I don't think it'll reset what you want.

"If you feel a post has answered your question, please click ""Accept as Solution""."
SCamp.1041
Associate III
Aug 27, 2025 12:24 PM UTC

It doesn't look like these functions exist in my version of the HAL. This is for the F446RE MCU. 

TDK
Aug 27, 2025 1:41 PM UTC
"If you feel a post has answered your question, please click ""Accept as Solution""."
SCamp.1041
Associate III
Aug 27, 2025 8:12 PM UTC

Ah yes, there they are.

However I can't say calling these has solved my issue. Could you help me understand the intention?

I am guessing I need to trigger the input capture interrupt via software. Triggering an interrupt will consequently clear/reset the capture counter back to 0. Is this the idea?