How to make automatic reset of slave timer in gated mode in STM32 mcu?


I've done synchronization between 2 timers: Timer#1 is configured as a slave in gated mode, Timer#2 is configured as a master, it toggles its output compare channel, which is an input for slave timer.

The timer overview (AN4013 application note on timers) states that: "the counter clock is enabled when the trigger input (TRGI) is high. The counter stops (but is not reset) as soon as the trigger becomes low". And it works just like that: when output of master timer becomes high, slave timer starts, and when it becomes low - it stops, but not reset, which leads to undefined behaviour - after changing output from "high" to "low", line sometimes becomes low (as I need it to) and sometimes doesn't change (standing high).

So the question is, if it possible to reset slave timer on trigger becomes low?

PS: I'm using STM32F103C8T6 microcontroller


1 Answer 1


I can't answer this specific question, but I have been trying to work through some timer problems of my own. Searching for that application note has an interesting 2nd hit on the ST forums..

One user volunteers some sad truths about the documentation:

The timers' description in ST's materials is an incredible mess. Instead of one properly written chapter, dealing with all the features and pointing out those omitted in the lesser-capable timers, they inflated the UMs with several copies of the timers' description, plagued with factual errors, omissions, apparent copy/paste and forgot-to-delete-this errors - plus the basic text is still of very poor quality.

For the 'F4xx, which I use, I tried to write down some of the most obvious errors in a "doc errors" writeup, http://www.efton.sk/STM32/STM32F4xx_doc_errors.txt ; but as far as the timers' chapters go, I'd recommend ST to discard the existing and rewrite it from scrap.

For your amusement, for example, have a glimpse at Table 49 on page 363 in RM0313...


Hopefully you find some answers in his errata... I have a lot of reading to do :/

  • \$\begingroup\$ Thanks for fast reply Daniel, I'll look at the errata you have found... \$\endgroup\$ Commented Dec 14, 2015 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.