Skip to main content
Ivan Dimitrov
Associate
May 16, 2018
Solved

Output compare mode - if configured as set active, how to set inactive by the software?

  • May 16, 2018
  • 1 reply
  • 1419 views
Posted on May 16, 2018 at 13:16

It is about stm32f103 (RM0008). When the compare register becomes equal to the timer register,

output compare mode - if configured as set active, how to set inactive by the software?

    This topic has been closed for replies.
    Best answer by Jan Waclawek
    Posted on May 17, 2018 at 08:08

    Yes, if the software is fast enough not to miss the next edge, why not.

    Or you could do it entirely in hardware, constructing a table of times, loaded into CCRx by DMA driven from that very same compare, using Toggle mode.

    JW

    1 reply

    waclawek.jan
    Super User
    May 16, 2018
    Posted on May 16, 2018 at 22:11

    For example by changing its mode into Force Inactive. Or in timers which have this function, by an external signal on ETR (see TIMx_CCMRy.OCzCE).

    JW

    Ivan Dimitrov
    Associate
    May 17, 2018
    Posted on May 17, 2018 at 07:47

    Thanks. Actually my goal is to generate positive edges at dedicated time, let say 10 different slots in sequence...

    Therefore the rising edge should be triggered by the hardware (timer) but the falling edge can be triggered by the software (because it ts not time-critical), when the next 'time' has to be set in the CCR .

    Is it correct to implement it in the following way:

    - Output compare mode: as set active

    - After the compare match (CCR==TIMx), change the output compare mode to Force Inactive, write new 'time' to CCR and then set output compare mode back to set active?

    I.

    Jan Waclawek
    Jan WaclawekBest answer
    Visitor II
    May 17, 2018
    Posted on May 17, 2018 at 08:08

    Yes, if the software is fast enough not to miss the next edge, why not.

    Or you could do it entirely in hardware, constructing a table of times, loaded into CCRx by DMA driven from that very same compare, using Toggle mode.

    JW