Skip to main content
Visitor II
August 26, 2025
Question

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

  • August 26, 2025
  • 3 replies
  • 260 views
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.

    3 replies

    Super User
    August 26, 2025

    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.

    Visitor II
    August 27, 2025

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

    Super User
    August 27, 2025
    Visitor II
    August 27, 2025

    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?