2021-08-19 05:11 AM
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 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:
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
2021-08-19 06:23 AM
What's wrong with driving a LED's PWM at 4kHz?
JW
2021-08-19 10:37 AM
Hi Jan,
Thank you for your prompt reply, I'll give a try
As for your concern about driving a LED's PWM at 4kHz, It work fine for the LED, however this 4KHz freq. generate some digital noise for my RF Antenna,
HW Eng. check manually and found out that Freq. about ~400Hz will NOT effect the RF Antenna
Best Regards,
Micha