Is it possible to use multi GPIOs based on one common PWM channel?
In my project I uses 2 LEDs and one Buzzer, all of them based on PWM control
My current HW implementation is as follow:
- Led#1 connected to PA.3 - PWM based on TIM2/CH4
- Led#2 connected to PB.9 - PWM based on TIM1/CH3N
- Buzzer connected to PA.0 - PWM based on TIM2/CH1
LED#1 and LED#2 should work at almost the same Freq. and the best for my needs is: 400Hz
and Buzzer optimal Freq. is: 4KHz
I set TIM1 Freq. to be 400Hz (CLK=64M, PSC=3 and Period=53333) - - and it works fine as expected!
I set TIM2 Freq. to be 4KHz with CH1 Duty Cycle: 50% - and it works fine as expected!
However this mean that LED#1on TIM2/CH4 must work at the same Buzzer Freq: 4KHz and NOT at 400Hz similar to LED#2
My Question are:
- In current HW setup is it possible to solve above issue, and make LED#1 & LED#2 to both work at 400Hz?
- Is there a GPIO solution, to activate both LED#1 (PA.3) and LED#2 (PB.9) from one common PWM channel (example:PB.9) ?
P.S. I also tried to make it using TIM2 interrupt, but this is involved with TIM Interrupt every 50-100uSec interval which cause performance degradation
Best Regards,
Micha
