2022-03-01 08:48 AM
I'm using an STM32 to control a DC motor with a dual hall encoder feedback.
To monitor motor position I want to use a General Purpose Timer (16bits) in Encoder Mode.
The configuration is going well but I notice that the logic is reversed:
I could fix this issue by flipping the wires, but I would prefer just changing a HAL configuration. Using CubeMx I tried to change the count direction settings without success (the behaviour stayed the same).
Is there a way to flip the timer counter logic?
Your help is appreciated.
Solved! Go to Solution.
2022-03-01 02:07 PM
2022-03-01 02:07 PM
Change polarity of one of the channels, using TIMx_CCER.CCxP.
JW
2022-03-01 02:26 PM
Hi @Community member
Thanks for your answer.
It worked perfectly.
I'm not sure I understand why it worked though. I don't see how switching channel 1 to Falling edges would reverse counting.
If you have any resources to learn about it, let me know.
Regards,
Gabriel
2022-03-01 03:42 PM
> I don't see how switching channel 1 to Falling edges would reverse counting.
It inverts the whole signal, thus rising edges become falling and falling edges become rising.
JW
2024-06-03 07:26 AM
In changing the phase of one of the timer inputs for the quadrature encoder to reverse it's direction of counting, how does this affect the index signal which in my case, is set to high when both phases are low, and is only a quarter of a phase wide? Might it not miss it totally, or do I have to redefine it in the encoder definition?
2024-08-05 10:00 AM
What is "index signal"?
Please start a new thread, stating what hardware and software are you using, what is the expected and what is the observed behaviour.
JW