cancel
Showing results for 
Search instead for 
Did you mean: 

use timer to decode pulse/step + direction signal?

crackwitz
Associate II

STM32 timers can decode quadrature signals.

STM32 timers can count external pulses.

can STM32 timers do pulse counting AND take counting direction from a second external input?

my current solution (on an STM32F303CB/CC, but also F103) is to let the timer count rising edges of the step signal and set the timer's counting direction in the handler function to an external interrupt on the direction signal.

to illustrate what a stepdir signal looks like and what it represents, I've taken attached a picture from http://support.motioneng.com/Technology/SynqNet/pulse_logic.htm and put a red rectangle around the step and dir signals (ignore cw/ccw graphs).

0690X00000AAEraQAH.png

2 REPLIES 2

> can STM32 timers do pulse counting AND take counting direction from a second external input?

No.

JW

JKota.1
Associate

Hello! Im trying to do the same thing right now.

>my current solution (on an STM32F303CB/CC, but also F103) is to let the timer count rising edges of the step signal and set the timer's counting direction in the handler function to an external interrupt on the direction signal

Could you please explan how you exactly are you doing this? My idea was to use External Clock mode and change the direction UP/DOWN by reconfiguring the Timer.