2021-03-10 12:01 AM
Hi! Regarding the microcontroller STM32F303x6/x8.
I have to generate 4+4 PWM waveforms. Waveforms from 1 to 4 have the same frequency but each must have different duty cycle. The waveforms from 5 to 8 have same frequency (different from the first group) but each has different duty cycle. I want to use one timer for the first group. And another timer for the second group. The datasheet states "4 independent channels for output compare" in each chapter describing the timers. What does it mean? Are There 4 channels for each timer? or are there 4 channels for each group of timers (4 channels shared for TIM2/TIM3/TIM4 and other 4channels shared for TIM1/TIM8/TIM20)? or are there only 4 channels for all the timers of the microcontroller? thank you.
2021-03-10 12:17 AM
4 channels for each timer is correct. tim1 & tim2 is enough.
2021-03-10 12:21 AM
just to understand. So I can set 4 match compare registers for TIM1 to generate 4 different interrupts. And the same for TIM2. so I can handle 4+4 PWM on the pins I want by setting manually the pins on the interrupt routine. Is it correct? Thank you so much.
2021-03-10 01:38 AM
You don't need interrupts for PWM, the TIM outputs PWM automatically if set to that mode, and if the respective TIMx_CHx pin is set as AF in GPIO.
Read the TIM chapter in RM.
JW
PS. Please tell us about your background, your questions sound like you are coming from Arduino or PIC world, is it so?
2021-03-10 01:44 AM
yes but why you need an interrupt. i don't see the need.
2021-03-10 01:48 AM
I cannot explain with messages. The application is more complicated. For some outputs I can operate as suggested with PWM mode. With others I need some interrupts to be generated in order to do other stuff... Thank you so much for the answers.