Skip to main content
momede
Associate II
March 23, 2021
Question

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

  • March 23, 2021
  • 1 reply
  • 1054 views

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.

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
March 23, 2021

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