AnsweredAssumed Answered

Reset timer counter on Input Capture

Question asked by xavier.jose on Jun 14, 2018
Latest reply on Jun 14, 2018 by xavier.jose

I have configured an timer IC channel and it is working ok however the timer counter isn't reset when I read the captured value: 

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim){
if (htim == &htim2)
   {
      input_capture = HAL_TIM_ReadCapturedValue(&htim2, TIM_CHANNEL_1);
   }
}

 

There is any register that I need to configure so the timer reset the counter each time it capture a value?

 

Per example I have a channel capturing a 10Hz signal however I'm only writing to serial port at 1Hz and I only want to write the last captured value. Without reset the counter the output I got is "1000, 2000, 3000, 4000,..." instead of always be 100 (I have the timer configured to 1ms resolution).

Outcomes