I'm trying here is to let the real-time units of the BeagleBone generate the signals for a stepper motor.
In this post: it works! Let's put everything together.
The pins P9_11 and P9_13 are used. I'm controlling them from the Linux command line.
|BB MUX||BB P9||Driver function|
To start, set sleep on and reset off
sudo -i # sleep on echo out > /sys/class/gpio/gpio30/direction echo 0 > /sys/class/gpio/gpio30/value # reset off echo out > /sys/class/gpio/gpio31/direction echo 0 > /sys/class/gpio/gpio31/value
config-pin P9_31 pruout config-pin P9_29 pruout
cp /home/debian/bin/bb_PRU_STEPPER.out /lib/firmware/bb_PRU_STEPPER.out echo 'bb_PRU_STEPPER.out' > /sys/class/remoteproc/remoteproc1/firmware echo 'start' > /sys/class/remoteproc/remoteproc1/state
I'm assuming that you installed the SPI overlay as explained in this post and created the binary in this post.
# sleep off echo 1 > /sys/class/gpio/gpio30/value
At this point everything is prepared, and you are ready to ....
This is it! Let's take 20 steps back and forth:
echo "120" > /dev/rpmsg_pru30 echo "020" > /dev/rpmsg_pru30
Submit as many commands as you want.
Once you disable sleep mode, the motor will pull 600 mA. It's locked in position. It will get hot.
If you don't play with the motor, or your device doesn't need the motor be kept locked in position, put the driver back to sleep:
cd /sys/class/gpio/gpio30 echo 0 > value
Finished? Clean Up.
echo 'stop' > /sys/class/remoteproc/remoteproc1/state
config-pin P9_31 default config-pin P9_29 default
|BeagleBone Control Stepper Motors with PRU - Part 1: Intentions|
|BeagleBone Control Stepper Motors with PRU - Part 2: Test Driving Outputs|
|BeagleBone: Enable SPI with Overlay and from Command Line|
|BeagleBone Control Stepper Motors with PRU - Part 3: Hardware Provisioning and Wiring|
|BeagleBone Control Stepper Motors with PRU - Part 4: SPI Setup|
|BeagleBone Control Stepper Motors with PRU - Part 5: It Works|