Question
Can you reset a timer counter from another timer's interrupt?
Posted on November 20, 2017 at 04:30
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
#timer-interrupts