Skip to main content
Explorer II
April 2, 2025
Solved

STM32F411E Disco Board - PWM

  • April 2, 2025
  • 2 replies
  • 667 views

I have been trying to get a PWM output from PE9 by following some example online. However no PWM output at PE9 pin. The desires PWM frequency is 20kHz and duty cycle is 50%. Any suggestion what is the problem ?. Thanks.

    This topic has been closed for replies.
    Best answer by Andrew Neil

    Are you sure that PE9 is not used by anything else on the Disco board?

    Check the User Manual and Schematics.

    Can you toggle it using just a simple GPIO write?

    2 replies

    Super User
    April 2, 2025

    The period is 50 and TIM1->CCR1 = 50; This won't work. For 50% PWM set period to 50-1 and TIM1->CCR1 = 25;

    hth

    KnarfB

    HL1Author
    Explorer II
    April 2, 2025

    Yes .. you are right. I overlooked this value.

    Super User
    April 2, 2025

    Are you sure that PE9 is not used by anything else on the Disco board?

    Check the User Manual and Schematics.

    Can you toggle it using just a simple GPIO write?

    HL1Author
    Explorer II
    April 2, 2025

    I had checked the schematic, PE9 is free and it is not used for other things. As mentioned by KnarfB, i had set the pulse width to 100%. Hence i only see a straight line instead of a PWM signal. I did though to toggle using simple GPIO write but i need to vary the pulse width.