Skip to main content
Lukasz Przenioslo
Associate III
September 28, 2015
Question

STM32F407 Motor + Encoder interface problem

  • September 28, 2015
  • 4 replies
  • 957 views
Posted on September 28, 2015 at 11:58

Hello there,

I am trying to build a stepper motor driver with encoder interface using stm32F4 discovery board. I have already configured and got working the stepper motor interface. For that I used Timers 1 and 8 like in the picture bellow (2 H bridges):

https://www.dropbox.com/s/31rrg5sldelfthn/Zrzut%20ekranu%202015-09-28%2011.49.10.png?dl=0

Now I would like to add the encoder interface which consists signals A and B. If I am reading the datasheet correctly for that I need timer 1 and 2. But timer 1 is also used for motor driving... Is there a way to overcome this and have both motor and encoder interfaces implemented?

I would apreciate all help!
    This topic has been closed for replies.

    4 replies

    matic
    Associate III
    September 28, 2015
    Posted on September 28, 2015 at 13:01

    For encoder interface you have to choose ''Encoder Mode'' under ''Combined channels'' menu. This will reserve 2 pins as inputs for A and B signals.

    Lukasz Przenioslo
    Associate III
    September 28, 2015
    Posted on September 28, 2015 at 13:16

    Thank you for you answer. So I dont have to use TIMER1 but just TIMER2 for the encoder?

    matic
    Associate III
    September 28, 2015
    Posted on September 28, 2015 at 13:28

    I am not sure what you need for driving your motor, but for reading A,B signals you definitely need only one separete timer with encoder interface capability. You select this under ''Combined channels''.

    Lukasz Przenioslo
    Associate III
    September 28, 2015
    Posted on September 28, 2015 at 13:30

    Thats what I meant. The documentation made me thing I need 1 timer per channel. Thank you.