cancel
Showing results for 
Search instead for 
Did you mean: 

I need to PWM two RGB LEDs to control the colour output, needing a recommendation on a basic processor (e.g. low power, 48 pins, TQFP) with a pair of three output compare pins. The part selector does not have a way of sorting on this basis.

rickygee49
Associate II
 
10 REPLIES 10

Pretty sure you'll find all the STM32 have at least 2 16-bit TIM with 4 channels

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

Its all a question of understanding, sifting through the manuals has not been fun. So as I understand it, if a Timer, say Timer 1 has Ch1, Ch2, Ch3 and Ch4 outputs, then they are the Output Compare pins, if programmed for PWM mode.

gbm
Lead III

Almost every STM32 will do (including the old good F103 on BluePill), maybe only the smallest STM32L0 models may not have enough channels. Another possibiblity is to use any F0/G0/L4/F7/H7/C0 single UART TX line to control two or more WS2812-alikes - only one pin is needed for a string of these LEDs.

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

Thanks for the rapid responses. Have an existing tightly packed four layer board layout, using an ATXMEGA(now not available until '24) so need to re-engineer it with an available processor. New part had to be close to 44 pins, cheapish, and QFP. After working my way through 20 or so first pages of data sheets, and cross checking against availability, found the L071. Nucleo board with the L073 is available, so I am on my way. All in all a days work to sort it out. Now the hard part starts, expect a few more queries, hard starting out on ARM at 74, my brain hurts.

Each TIM can have one frequency (single count element), unless you keep updating it.

The 4 channels can have there own duty cycles. ie four comparators / latches

So if I set it up for 50 Hz (20 ms), I could control 4 servo's independently.

PWM of different frequencies, might want a TIM each if you don't want to baby-sit them continuously.

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

On the ATXMEGA I ran the two timers at a fixed frequency, and set the terminal count according to which band an analogue signal was in. This PMW'd the RGB LEDs to give one of six colours. So needed two timers and 6 terminal count channels in all.

gbm
Lead III

Consider G0 or C0 series - cheaper and more easily available than L0, also easier to route (less power pins).

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

i used for similar ... F030 , lqfp48 , 2 € , digkey has 27000 in stock.

Tim1 +Tim3 have x4 pwm outputs .

https://www.digikey.ch/de/products/detail/STM32F030C8T6/497-14043-ND/4357252

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for the input, G0 and C0 don't meet some of my other requirements unfortunately, power not an issue, 4 layer board has a power plane.