cancel
Showing results for 
Search instead for 
Did you mean: 

Which TIMs support Quadrature encoder

Elham
Associate II

Hello,

I am trying to use the quadrature encoder mode of the TIM in the STM32U585VITx, for positioning purposes of a stepper motor movement.
According to DS13086, page 79, the general purpose timers (TIM2, TIM3, TIM4, TIM5, TIM15, TIM16, TIM17) support quadrature encoders.
However, according to RM0456 Rev 5, page 2083, TIM 1.8 has support for quadrature encoders.
Could you please clarify which TIMs support this encoder?

Also, I am currently trying to use TIM8 for this purpose (not sure if it is the right timer), but when I move the motor and read the timer, I just get a bunch of zeros.

Any help would be greatly appreciated,

Thank you

12 REPLIES 12

Read out and check/post content of TIM and relevant GPIO registers content.

By reading out GPIOx_IDR check, if the respective bits are toggling when you turn the encoder slowly.

JW

PS>

htim8.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED3;

This should be ignored in Encoder mode; but for good measure, set it to default ("edge aligned", I don't know what's the Cube parlance for this).

Thank you for your suggestion,

I checked GPIOx_IDR and there is no change there while motor moves.

Unless those pins are set as Analog by some mistake, you then have some electrical problem beyond the STM32.

Start with observing the encoder outputs using preferrably oscilloscope, proceed with checking continuity up to the mcu pins.

JW