cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 – quadrature / encoder operation and associated Timers

TMA1of3
Associate III

hello ST,

I’m reading about quadrature / encoder operation as would be used for positioning control of stepper motors. We use the STM32H743 in another application, and we need to determine how many channels (how many individual stepper motors) could be independently controlled from this micro using this in-built quadrature / encoder mode.

Section 38.2 of the RM0433 Reference Manual (Rev 7 although I think 8 is the same) suggests that only TIM1 and TIM8 support this quadrature / encoder functionality – is that correct ? Does that mean only two stepper motors could be individually controlled from this micro using this in-built circuitry with associated Timers ? 

Figure 387 in that same document (also in Section 38.2) shows the Encoder Interface block being fed by TI1FP2 and TI2FP2. Is it therefore correct to say that these two inputs must be fed by TIM1 and TIM8 ?

Is there another micro in the range that supports control of four stepper motors (meaning it has four such Timers) ? I’m trying the on-line Product Selector, but quadrature / encoder control doesn’t seem to be one of the listed options.

Thank-you.

4 REPLIES 4

If you'd look at other timer chapters, you'd see that there's encoder mode in other timers, too.

Also, you may be confusing the quadrature encoder *input* facility of timers with generation of quadrature *output* signal. The latter is about generating 90 degree shifted 50% duty cycle outputs, and probably all timers which have at least two channels are capable of that (using the channels as Output compare, in properly initialized Trigger mode).

JW

TMA1of3
Associate III

Thank-you very much, Jan.

I was referring to the inputting of a quadrature signal (group of signals actually), as may be expected from the output of an encoder used with a stepper motor, which are then interpreted with the use of a Timer having this facility.

Right you are, thanks … there are further Timer chapters mentioning ‘encoder’ mode compatibility for example TIM3 and maybe TIM12 also. Do you know if TIM1/8 work exactly the same way, in terms of their encoder facility, as do TIM3/12 ?

The doco for TIM1 and TIM3 both mention an ‘Update Interrupt Flag UIF�?, and in the “stm32h743xx.h�? file there’s an Interrupt Number Definition for ‘TIM1_UP_IRQn’, but nothing like this for TIM3 ? 

The TIM12 main features paragraph doesn’t specifically refer to encoder, but does later in Figure 464 show an Encoder mode input but still without a dedicated Encoder chapter to describe its performance – do you know if TIM12 does actually implement this facility as per TIM1 ?

If I may ask about the physical pins on the micro (that carry the signals that then make their way through the internal circuitry before reaching TI1FP1/2) … is it true that any I/O pins can be chosen with this Timer encoder mode, or does this datasheet specifically state which pins can be used ?  I’ve looked but it’s not obvious that they’re limiting the choice hence I’m thinking any pins can be used ?

> Do you know if TIM1/8 work exactly the same way, in terms of their encoder facility, as do TIM3/12 ?

AFAIK there's no difference in this.

> The doco for TIM1 and TIM3 both mention an ‘Update Interrupt Flag UIF�?, and in the “stm32h743xx.h�?

> file there’s an Interrupt Number Definition for ‘TIM1_UP_IRQn’, but nothing like this for TIM3 ?

There is one single interrupt for all interrupt sources in TIM3 (and also most other timers - TIM1 (and maybe TIM8) is the exception).

However, I would recommend against using Update interrupt when using encoder mode.

> do you know if TIM12 does actually implement this facility as per TIM1 ?

I don't know and I don't use the 'H7. There are many copy/paste errors in the narrative in timer chapters. The definitive guide is whether TIMx_SMCR.SMS contains encoder modes. It does not, so TIM12 does not implement this.

> is it true that any I/O pins can be chosen with this Timer encoder mode

Only TIMx_CH1/TIMx_CH2 pins.


_legacyfs_online_stmicro_images_0693W00000bkOWVQA2.png 

JW

TMA1of3
Associate III

Thanks Jan for your clear explanations. So that unfortunately confirms TIM12 isn’t an option leaving us TIM3 and no other free Timers (from the main choices) in our application (we’d like one more for another stepper input). Timer LPTIM does claim an encoder mode although the manner in which this Timer’s chapter explains which pins can be used is different to other Timers and to your explanation above. Are they lptim1_in1 and lptim1_in2 ?

PS. Why do you recommend we not use the UP interrupt ? And if I may ask, please, are you an employee of ST ? Your advice has been invaluable, thanks, but I’m just wondering if ST employees respond on this forum or if it’s ST users.