cancel
Showing results for 
Search instead for 
Did you mean: 

LED is not glowing in PWM mode NUCLEO-F302R8 Board

prashjain007
Associate II

Dear Community

I am not able to glow Green LED on Nucleo Board. I have generated code through STM32CubeMX. I have attached files. Kindly help.

6 REPLIES 6

Start with something simpler: set the pin where the LED is to GPIO Out, and set it to 1, and you should see that LED is ON (if it's connected through resistor to GND). Try the same with setting output to 0. Only if that works, go for the timer.

JW

And use a scope for frequencies beyond perception of the human eye

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I have developed code for led glowing without timer. It is working absolutely fine. But with pwm, it is not glowing. I am starting pwm in main. Whatever frequency it is, led has to glow for duty of 50%.​

JAlca
Senior

I think User may be right and the frecuency is too high.

Try blinking the led every 500ms.

TIM1->PSC = (SystemCoreClock / 1000) - 1; //Now timer counts miliseconds

TIM1->ARR = 1000; //Count every second

TIM->CCR1 = 500; //Duty is 50%.

I tried blinking at every 500ms but still not working. Even for high freq, LED should glow without blinking.

Read out and check/post content of relevant GPIO and TIM registers.

JW