cancel
Showing results for 
Search instead for 
Did you mean: 

Step+Dir Interface to STM32F4

megahercas6
Senior
Posted on May 30, 2016 at 05:42

Hello, i am in the path of developing brush-less DC servo system for CNC mill,

Because i will use motor encoder, as well as position quadrature encoder, i need ability of hardware tracking step and dir impulses. It would be best to use signed counter, so my PID loop will be as efficiency as it can be and with no jitter.

Basically i need 32b counter that counts external impulses with up/down mode selection by external pin. But it i was unable to find how to do that. Any idea how

?

I really don't want to use interrupt on STEP pin, that will check direction and do cnt++ or cnt-- operation, that can be problem, when i get pulses at more than 100kHz
3 REPLIES 3
Uwe Bonnes
Principal III
Posted on May 31, 2016 at 15:30

Have a look at encoder mode with SMS= 001 or SMS=010.

Walid FTITI_O
Senior II
Posted on May 31, 2016 at 16:15

Hi karpavicius.linas,

I recommend you to take a look on both following Timer examples in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

:

-''TIM-Encoder'' at this path :

stm32cubef4_1.11\STM32Cube_FW_F4_V1.12.0\Projects\STM324xG_EVAL\Examples\TIM\TIM_Encoder

-''TIM_6Steps'' at this path:

stm32cubef4_1.11\STM32Cube_FW_F4_V1.12.0\Projects\STM324xG_EVAL\Examples\TIM\TIM_6Steps

-Hannibal-

megahercas6
Senior
Posted on June 02, 2016 at 06:30

Thank you all, will try to explore that :)