Skip to main content
gbulmer
Associate II
September 12, 2010
Question

Can TIM3 PWM outputs be set to Open Drain?

  • September 12, 2010
  • 5 replies
  • 2053 views
Posted on September 12, 2010 at 15:13

Can TIM3 PWM outputs be set to Open Drain?

    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:06

    Wouldn't you just program the GPIO pins into the Alternate Function, Open Drain mode? instead of the normal Push-Pull (GPIO_Mode_AF_PP)

      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;

      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;

      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

      GPIO_Init(GPIOC, &GPIO_InitStructure);

    Presumably you've checked the pins are in the 5V tolerant group?
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:06

    Have you ever tried configuring the combination of PWM & Open Drain?

    No, and motors aren't my deal. But I have modulated a tri-colour LED from TIM3/PWM on PC.06/07/08, and I have used OD on other pins. So I'm pretty sure the pin-drivers work as described, and they are the same whether they are driven by a GPIO or a peripheral (AF).

    You might want to verify the function of these pins, and perhaps others,  in regular GPIO_Mode_Out_OD, in the absence of other circuitry, and confirm they behave in the manner you expect.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    gbulmer
    gbulmerAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:06

    clive1 - Thanks for the confirmations, that helps a lot.

    I'll test the pins as you suggest. I'll do that when I'm near an oscilloscope (hopefully tomorrow).

    gbulmer
    gbulmerAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:06

    clive1 - thank you for responding. 

    I apologise for my tardiness, I've been stressfully busy this week.

    Yes the pins are in the 5V tolerant group.

    Have you ever tried configuring the combination of PWM & Open Drain?

    gbulmer
    gbulmerAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:06

    clive1 - sorry I forgot to pop back and acknowledge that you were correct.

    It works!

    Thanks for your help.