cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder Interface: independently on the encoder direction the counting has to be always incremental

momede
Associate II

The need I have is to count the encoder pulses on each front of the two channels (x4) always incrementing the counter independantly on the encoder direction and only have a tag on the direction changes.

I configured the TIM2 as encoder input (as shown in the picture TIM2 Config) with the counter preload to 1 and generate the TRGO to the TIM5 used as slave to count the encoder pulses.

The problem I have is that in the TIM5->CNT I have only half pulses as the counter x2 instead of x4.

Many thanks in advance to who will help me to solve this issue.

1 REPLY 1

Connect the two lines physically to two timers' CH1 and CH2; use one timer to detect direction and in the other count edges for both channels and then add them together.

JW