2017-02-21 12:50 PM
Hello guys,
I would like to use an quadrature encoder for a motor control application on an STM32F303K8T6.
Unfortunately the hardware gives me the following configuration:ENCODER_OUT_A -> PA2 (TIM2_CH3)
ENCODER_OUT_B -> PA3 (TIM2_CH4)ENCODER_OUT_Z -> PA5 (TIM2_CH1)Is there any possibility to use CH3 and CH4 instead of CH1 and CH2 as timer count input
andCH1 as capture timer value input?The quadrature encoder generates 1024 per machanical revolution and get spinned up to 10krpm.
best regards
#motor-control #quadrature-encoder2017-02-21 01:17 PM
Is there any possibility to use CH3 and CH4 instead of CH1 and CH2 as timer count input
No.
JW
2017-02-21 03:18 PM
You may be able to use external interrupts and count the steps yourself...
1024 x 10,000 /60 = 171kHz x 4 edges, 682Khz interrupts
at 72Mhz cycle rate, its about 100 cycles per interrupt, yes it can be done, but nothing else
and if you miss a count, you are in big trouble, smashing the machine..
but it is far better to use the hardware functions provided for this purpose...
JW has the correct short answer.
2017-02-21 03:32 PM
What about using TIM15?
2017-02-21 04:51 PM
you actually don't need to use timers...
just interrupt pins, but it is dangerous for the machine equipment if the count is wrong and then you smash into the stop..
2017-02-21 05:01 PM
Good idea.
2017-02-22 02:29 AM
Are you sure TIM15 can be used in encoder mode? There is no description in the reference manual for TIM15 and the datasheet 'Table 5. Timer feature comparison' says TIM15 has just an UP Counter mode.
2017-02-22 02:50 AM
Indeed. I did not dig deeper, sorry.
JW
2017-02-22 04:04 AM
You seems to be right. Also RM0316 Rev 8 Figure 256 TIM15 block diagram shows '+/-' counter there is no downcounting mode. Congratulation to ST for some other saved transistors!