2019-09-19 02:28 AM
Dose someone know if it is possible to use TM3 in Encoder Mode. And also get the internal detected counts for each input. I use TIM3 channel 1 and 2 for the encoder.
many thanks
2019-10-03 10:36 AM
If you want to count (or detect) transitions on the encoder lines separate from the encoder function, you have 2 choices: (1) run the two encoder lines to two additional timers (one for phaseA and one for phaseB) and have each timer count pulses on one of the two phases, or (2) use EXIT as in my original post. Each timer has only one count register, so it can only count one thing.
2019-10-03 12:11 PM
There is one more option, more of a trick - count one input as I've outlined above, through the TRGO-TRGI timers link, and use the other to trigger dummy DMA transfers, then NDTR of the DMA is your counter.
JW
2024-03-11 08:44 AM
I am trying to use encoder interface mode with stm32fx103 but even though i selected TI1 ONLY mode and also selected polarity to RISING by polarity bit but i got DOUBLED counts then my encoder max PPR ,can you please help me....
2024-03-11 10:00 AM
> i got DOUBLED counts
The original STM32 timer supports only x4 and x2 modes (newer STM32 such as 'G4 supports also x1).
Simply divide what you read out from TIMx_CNT by two.
JW
2024-03-12 05:21 AM
but where i am learning these they said to do these task without dividing it and if you know where it is exactly written about how many times it mutiplied then please mention it...
2024-03-12 06:28 AM
It is not *multiplied*. The x2 mode just means, that for every cycle (which contains 1 pulse = 2 edges on signal A and 1 pulse = 2 edges on signal B) the counter counts +-2 (because it counts both the rising and falling edge of one of the signals). The x4 mode counts both edges on both signals, so that is +-4 per cycle.
"Polarity selection" in Encoder mode is a bit misleading name (but is in fact good name for the main purpose of the timer channels set as input, i.e. Input Capture); in encoder mode this does not *select* the edge, but determines, whether the input signal is inverted or not, before it enters the decoder.
> where i am learning these they said to do these task without dividing it
You can't.
Your teacher maybe wants you to set the prescaler (TIMx_PSC) to perform that division, but I recommend not to do that (or you can do that just to fulfull a school assignment, but don't use it for real application).
JW