cancel
Showing results for 
Search instead for 
Did you mean: 

Control LED light

Ala
Senior

hey there

I have a project where I need to control light of a LED and dim it. usually we use TIMER PWM GENERATION. for example in CubeMX I set a pin to TIMx CHy and by choosing "PWM Generating CHy" I can easily control LED light using PWM signal.

but in my case this LED pin has no TIM Channel connected to it. what should I do to dim the LED?

10 REPLIES 10
gbm
Lead III

You may use 2 channel DMA to GPIO BSRR triggered by timer update and compare; set on update, reset on compare. The only quirk is to prevent outputting active level at timer update when duty is equal to 0.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice