Skip to main content
Explorer II
March 27, 2024
Solved

Encoder pin assign in STM32F103C8T6

  • March 27, 2024
  • 1 reply
  • 2147 views

Hello.

I have plans to implement a motor encoder interface circuit using this micro controller. According to its datasheet, the timer implementation considers TIM1 ~ TIM4.

My question is: which pins can I assign to implement a motor encoder circuit for high resolution (1024PPR) encoder?

The encoder has 2 output pins (A and -A).

 

Thank you in advance.

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    You mention STM32F1 but tag post as STM32F3, please fix

    All the TIM on the F1 will be limited to 16-bit, each has a single counting element.

    Encoder mode will use CH1 and CH2 of the respective TIM, for the A/B or +A/-A type inputs.

     

    GPIO and EXTI could be use for a software encoder, with 32 to 64-bit count resolution, for EXTI I'd pair like PB0/PC0 or PA5,PD5

    1 reply

    Graduate II
    March 27, 2024

    You mention STM32F1 but tag post as STM32F3, please fix

    All the TIM on the F1 will be limited to 16-bit, each has a single counting element.

    Encoder mode will use CH1 and CH2 of the respective TIM, for the A/B or +A/-A type inputs.

     

    GPIO and EXTI could be use for a software encoder, with 32 to 64-bit count resolution, for EXTI I'd pair like PB0/PC0 or PA5,PD5

    Visitor II
    March 27, 2024

    I am not sure encoder you are using. However, here is a tutorial on STM32CubeIDE L298N Motor with STM32F103C8T6. This may help you:

    https://www.youtube.com/watch?v=0rbKmkNEdAU

    If you ever try to make an Advanced 8-Channel RC Transmitter and Receiver with STM32F103C8T6, you can see here: https://www.pcbway.com/project/shareproject/Advanced_8_Channel_RC_Transmitter_and_Receiver_with_STM32F103C8T6_6b3dc594.html

    claudiohiAuthor
    Explorer II
    March 28, 2024

    Thank you so much for the information!