u/ProfessionalDig8060in r/embedded • Recommends
On “PWM signal with different frequencies”
Like others have said, PWM frequency is determined by the ARR value. All the channels (I believe this is what you mean by port) of a timer share a common ARR. Each channel has a unique CCR which let's you change their duty cycles but PWM frequency will be the same.
Use different timers.
I suggest you watch this video to understand the terms PWM duty cycle, PWM frequency, PWM resolution etc. It will help you select the ARR, CCR, PSC values for your application.
In addition, this book by Dr. Yifeng Zhu will help you get comfortable with the registers involved. You'll be able to read datasheets far easier than before. He's used STM32 as an example but it'll all work out as the registers ar…