cancel
Showing results for 
Search instead for 
Did you mean: 

can I use one timer to interrupt another timer (start and stop)

MNapi
Senior III

I want to generate 1 Mhz with one timer but I want to stop it for 1 ms and then generate for 5 ms.

I see that there is instruction HAL_TIM_Base_Start_IT looks like I can start and stop one timer with anther, I am using Cube MX and keil.

1 REPLY 1

Yes, you can simply enable/disable the 1MHz-generating timer by setting/clearing its TIMx_CR1.CEN from the slower-running timer's interrupt. Or, maybe better, change it's compare channel mode from PWM to some of the forced modes as appropriate.

But you can also do this without any software intervention, by setting the slower timer as master, the faster as slave, in gated (or maybe in reset) mode.

I don't use Cube.

JW