STM32L433RC and quadrature encoders - twice the expected pulses?
- June 30, 2018
- 6 replies
- 2859 views
Hello,
I have configured TIM1 and TIM2 as combined channels (encoder feature), set pins to count on falling edge using TI1 encoder mode (please, see images below), added pull ups to the lines. However, I can see the timers counting on both edges.
After an unexpected result during my real tests (I have a large system with motors and encoders with 1024 pulses per rotation) I did a very small test using those arduino module encoders (KY-040) and I could confirm these behavior.
I tested all edges combinations and modes. I checked the register configuration done by CubeMX against the reference manual and it seems fine. The result is the same, counting twice as expected (for TI1 mode), using both edges to count. I tried also to set 'Prescaler Division Ratio' as 2, but it didn't work as well. By the way, processor errata does not mention anything related to encoder problems.
So, am I doing something wrong here ? Or, is this the expected behavior ?
PS: When using both TI1 and TI2 encoder mode I had four times the amount of expected pulses.
#encoder #tim #stm32l433 #quadrature-encoder