2020-02-20 01:45 AM
In the Reference Manual R0008, there is "Using one timer to start another timer" in Chapter 15.3.15. I want to know whether "use a timer to stop another timer" can be realized.
Besides, I want to stop the timer in a rising edge, so the gated mode can't be used. I don't want to use interrupt either because it causes some delay.
2020-02-20 02:28 AM
There's no direct way to do this.
Indirectly, you can trigger from the first timer a DMA transfer from memory to the other timer's CR1, containing the required value to stop the timer.
> I want to stop the timer in a rising edge
I don't understand what do you mean by this; a timing diagram would help if you want to discuss this further.
JW
2020-02-20 02:57 AM
In the gated mode (SMS = 101), a timer works when its TRGI is high. That is to say, a timer can be stoped in a falling edge of the output of another timer. So I think it difficult to stop the timer in a rising edge.
2020-02-20 05:28 AM
Although I don't understand either what exactly you want to do (why don't you just invert the output polarity of the master, or use another channel/synchronized third timer), here's something that might help
TIMx control register 1 (TIMx_CR1)
Bit 1 UDIS: Update disable
This bit is set and cleared by software to enable/disable UEV event generation.
0: [snip]
1: UEV disabled. The Update event is not generated, shadow registers keep their value
(ARR, PSC, CCRx). However the counter and the prescaler are reinitialized if the UG bit is
set or if a hardware reset is received from the slave mode controller.
You can use this mode to stop and reset the timer on the rising edge. (But I'm not 100% sure that it would work).
Now beacuse ARPE is set, ARR=0 will be effective first when reset is triggered by the master. Then ARR will become 0, and the timer is effectively stopped.
2020-02-20 06:12 AM
OK, thanks. I'll have a try later.
2020-02-20 06:15 AM
OK, thanks. I'll have a try later.