Associate
February 15, 2023
Solved
Counting pulse + direction encoder
- February 15, 2023
- 2 replies
- 3046 views
Hello,
I'm trying to read the pulse counter with a timer on STM32H747. The counter produces pulses up to 100KHz on one timer channel and high \ low signal to define the direction.
I tried two approaches.
- Reference manual says, as I understand, that such signals are supported out of the box. Section 40.3.22 says "To select Encoder Interface mode write SMS=‘001’ in the TIMx_SMCR register if the counter is counting on TI2 edges only, SMS=’010’ if it is counting on TI1 edges only and SMS=’011’ if it is counting on both TI1 and TI2 edges." But setting it to TI1 only mode still behaves as TI1 & TI2. So, it reads quadrature signal, not pulses.
- Then I tried to use the timer in counter mode. It didn't work for me.
My questions are: does encoder mode supports pulse + direction signal, and is there a good example of using a timer in counter mode (mode 1)?
Thanks.
