Skip to main content
Associate
Apr 2, 2025 3:21 AM UTC
Solved

STM32F411E Disco Board - PWM

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.
Andrew Neil
Andrew NeilBest answer
Super User
Apr 2, 2025 7:55 AM UTC

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.

4 replies

KnarfB
Super User
Apr 2, 2025 6:50 AM UTC

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
Apr 2, 2025 8:13 AM UTC

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

Andrew Neil
Andrew NeilBest answer
Super User
Apr 2, 2025 7:55 AM UTC

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
Apr 2, 2025 8:18 AM UTC

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.