Skip to main content
Associate
April 2, 2025
Solved

STM32F411E Disco Board - PWM

  • April 2, 2025
  • 2 replies
  • 668 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.

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

KnarfB
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
Associate
April 2, 2025

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

Andrew Neil
Andrew NeilBest answer
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?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
HL1Author
Associate
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.