Skip to main content
Visitor II
May 7, 2024
Solved

Can COMP7\ETR1 reset TIM20 on only one edge instead of both?

  • May 7, 2024
  • 1 reply
  • 1096 views

I have TIM20 configured in reset mode and I want the output of COMP7 to reset it. I have TIM20 configured with ETR routed to COMP7 and I can see the timer being reset on both of the edges of the COMP7 signal. I only want TIM20 reset on one edge. 

I'm using CubeIDE and I see options for choosing rising\falling\both for input capture, but no way to do it when routing from the internal comparators. Is this possible?

    This topic has been closed for replies.
    Best answer by KHarb.1

    Yes, I saw that, but that didn't seem to do what I need.  The board I'm using makes it difficult to detect if the behavior I'm seeing is due to lack of hysteresis on the COMP and input filtering on the timer...which would make noisy transitions show up as triggering on both edges. 

     

    1 reply

    ST Employee
    May 8, 2024

    Hello @KHarb.1

    check the TIMx_SMCR.ETP bit, you can use it to control the polarity of the external trigger

    According to RM: "Bit 15 ETP: External trigger polarity
    This bit selects whether tim_etr_in or tim_etr_in is used for trigger operations
    0: tim_etr_in is non-inverted, active at high level or rising edge.
    1: tim_etr_in is inverted, active at low level or falling edge" 

     

    KHarb.1AuthorAnswer
    Visitor II
    May 8, 2024

    Yes, I saw that, but that didn't seem to do what I need.  The board I'm using makes it difficult to detect if the behavior I'm seeing is due to lack of hysteresis on the COMP and input filtering on the timer...which would make noisy transitions show up as triggering on both edges.