cancel
Showing results for 
Search instead for 
Did you mean: 

Single timer for encoder on Channel 1 & 2 and PWM generation on Channel 3?

KS7
Associate

Hi. I'm using the STM32F407VE6 Microcontroller board. Is it possible to use a single timer to generate PWM from channel 3 and read the encoder values from channel1 & 2 of the same timer? 
When I tried using 2 different timers, one for PWM and the other for the encoder it worked fine.
 If it's impossible to use the same timer for both operations, why are channels 3 and 4 available for PWM generation?

2 REPLIES 2
TDK
Guru

Timers have a single counter register. You cannot use a timer for an encoder and for PWM at the same time.

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

> If it's impossible to use the same timer for both operations, why are channels 3 and 4 available for PWM generation?

Even with the counter clocked from the encoder, you may find uses for the compare features, including the functionality which is called PWM. You may for example want generate a pulse when a rotary encoder rotates through some portion of its path.

JW