To control a stepper motor, your device has to create a pulse signal (pulse train).

That signal will decide how many steps the motor takes and how fast it takes those steps.

There are several ways to generate that signal: using timers, bitbang and others.

What I'm trying here is to let the real-time units of the BeagleBone generate the pulses.

image source: modified from TI Designs: High Performance Pulse Train Output (PTO) With PRU-ICSS for Industrial Applications

 

 

Intentions

The goal is to generate the control signals for stepper motors on a BeagleBone.

The PRU subsystem has to generate the pulses, with as little as possible involvement from the main controller.

I'd like to provide an API that accepts direction and steps. Then add options that refine the motor rotation profile.

The solution should work on Linux.

 

The reason for this exercise is not to make the best motor controller out there. I want to get better at PRU programming and this helps.

 

Approach

  • generate a linear speed pulse train. - done
  • refine to add ramp up, speed and ramp down.
  • add support for several outputs, each following their own instructions.
  • add support for gathering a batch of commands, then activate them. - done
  • add support for a command queue, where you can send additional commands while the motor is running. - done

 

 

Assumptions

The ARM controller will manage SPI communication, enable and reset signals.

The PRU will manage the pulse train and direction signals.

 

Hardware

 

 

I selected the motor and driver because I have them. I used them on several controllers before.

If something doesn't work hardware-wise, I can rebuild previous projects and compare the failing setup here with a known working one.

 

Software

 

First steps in the next post. Create a PRU program that will generate X amount of pulses. Any frequeny that I can make work.

 

Related blog:
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