Intercepting step/dir with an Arduino
-
Hi all!
I'm trying to read the signals coming from the E2_STEP and E2_DIR pins on the expansion header with an Arduino. For every step pulse while DIR is high I want to increment a counter and for every step pulse while DIR is low it is decremented.
The problem I encountered is that the DIR pin doesn't have either a high or low state but instead just sends a positive/negative spike for each direction change. I checked this with an oscilloscope.
Is this the expected behaviour? From what I've read the DIR pin should either be constantly low or high.Btw, I know that the Arduino Mega uses 5V logic and the Duet WiFi outputs 3.3V at the expansion header but for now this doesn't seem like a problem.
-
@Eumldeuml said in Intercepting step/dir with an Arduino:
I checked this with an oscilloscope.
which settings did you use for the scope?
-
@Eumldeuml said in Intercepting step/dir with an Arduino:
From what I've read the DIR pin should either be constantly low or high.
That's correct, it should only change when there is a direction change. Are you sure you are not looking at the STEP pin instead?
-
wouldn't the step pin just be a series of high pulses and not negative?
sounds to me like hes viewing the dir signal ac-coupled?
-
Regarding the settings for the scope, I'm not sure which ones you mean.
The step pulses are what you'd expect but the DIR signal is not. On the picture you can see both signals, STEP on top, DIR below. The sampling rate probably isn't high enpugh to catch all the pulses (pulse width is set to 2 µs) but otherwise you wouldn't be able to see the whole spike on the DIR channel.