AnsweredAssumed Answered

Can you reset a timer counter from another timer's interrupt?

Question asked by Richard Cooke on Nov 20, 2017
Latest reply on Nov 20, 2017 by Richard Cooke

Can you reset a counter from another timer?  I'm using TIM2 as a PWM input and in the callback() I'd like to reset the counter for TIM22 to stop it from triggering its interrupt.  Is this possible?

 

This is what I've tried but the TIM22 counter doesn't change:

 

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
    if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
     {
        TIM22->CNT = 0;      // <--  This doesn't change the count.
        HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);         // gives me something to look at with the oscope
     }

}

 

Any help is greatly appreciated.

 

Richard

Outcomes