Demand Peripherals     Robotics and Automation Made Easy

STEPU: Unipolar Stepper Motor Controller

The STEPU peripheral controls the step rate, direction, and target step count of a unipolar stepper motor. You can incrementally add counts to the target step count.



The unipolar stepper motor controller controls the on/off state and direction of four open-drain drivers connected to the coils of a unipolar stepper motor. The STEPU peripheral is most often paired with DRV4, the quad open-drain driver card. More information about the DRV4 card can be found here: cards/drv4.html.



Resources for the unipolar stepper motor controller let you control direction, step rate, and select either full or half steps.

config : controller configuration.
Stepper motor configuration include the mode of operation, the direction, the step rate, and the holding current as a percentage of full current. The configuration format is:

    [mode],[direction],[rate],[hold current %]
Three modes of operation are available: off, full-step, and half-step. The mode is specified as one of the words 'off', 'full', or 'half'. The first letter of each word can also be used. The off mode removes all power to the drivers. The power on default mode is off.

The direction is given as 'forward' for a step sequence of ABCD and 'reverse' for a sequence of DCBA. The single letters 'f' and 'r' can also be used. The default is forward.

The motor step rate is given in Hertz. The driver tries to use a step-rate as close as possible to the one specified. For example, a requested step-rate of 511 Hertz might result in an actual step rate of 500 Hertz. The step rate has 8 bits of accuracy, and a range from 4 Hertz to 1 MHz.

The holding current is given as a percentage of full current and is in the range 0 to 99 percent.

Sample configuration commands include the following:

        dpset stepu config off forward 400 10
        dpset stepu config half reverse 125 25
        dpset stepu config f f 200 99

count : target step count.
The count resource specifies the number counts. Is is entered as a unsigned decimal number in the range of 0 to 4095. This is a read/write resource. Setting this to zero stops the motor but leaves the coils energized. This value is decremented by one for each step (or half step) taken. The motor stops when the count reaches zero. A read of count show how many steps remain to be taken but be aware that latency in reading the value from the board means that the actual steps remaining are probably fewer that what is reported.

addcount : synchronously add counts to target.
The addcount resource is an unsigned decimal number in the range of 0 to 4095 that is added to the target count. The addition is done in the FPGA so that the addition is synchronous to the steps. Addcount is needed for accurate movement when the target number of steps is larger than 4095. For example, to accurately step out 6000 steps, you would write 4000 to count, and then some time later write 2000 to addcount. This is a write-only resource.



Step in the forward direction for 200 full steps at a step rate of 40 steps per second and use a holding current of 10 percent of full power.

     dpset stepu config full forward 40 10
     dpset stepu count 200


Note that the PWMOUT4 peripheral has four PWM outputs with 12 bits of resolution. You can use the PWMOUT4 peripheral for high resolution (if very slow) micro-stepping of a unipolar stepper motor.


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Quad Serial Output
Octal Serial Output
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator

Interface Cards
Control Cards
User Interface
Stereo Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
Octal SRF04
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
Octal Input/Output
32 Channel Input
32 Channel Output
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card