element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BeagleBone Control Stepper Motors with PRU - Part 1: Intentions
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 23 Jul 2019 3:06 PM Date Created
  • Views 4614 views
  • Likes 10 likes
  • Comments 4 comments
  • debian
  • stepper_motor
  • pru
  • real_time_systems
  • stepper_motor_drive
  • BeagleBone
  • linux
Related
Recommended

BeagleBone Control Stepper Motors with PRU - Part 1: Intentions

Jan Cumps
Jan Cumps
23 Jul 2019

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

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

 

image

 

Assumptions

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

The PRU will manage the pulse train and direction signals.

 

Hardware

image

 

  • BeagleBone (any I guess. Certainly the popular ones)
  • DRV8711 stepper motor controllerDRV8711 stepper motor controller
  • Adafruit Nema 12 V stepper motor, 200 steps

 

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

  • A BB supported Linux. I used the latest Debian Image, Stretch IoT (without graphical desktop) for BeagleBone and PocketBeagle: Debian 9.5 2018-10-07
  • Code Composer Studio and GCC Cross-platform compiler

 

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
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 6 years ago in reply to DAB +2
    DAB wrote: I look forward to seeing your results. DAB I've got the first mini-result: set a DIR pin and output a naive pulse train: BeagleBone Control Stepper Motors with PRU - Part 2: Test Driving Ou…
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to genebren +1
    genebren wrote: ... Any plans to use micro-stepping? ... The stepper driver supports it - it's not a thing I control in the PRU. You go into the supported microstep mode by giving a SPI commands to a register…
  • DAB
    DAB over 6 years ago +1
    I look forward to seeing your results. DAB
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to DAB

    DAB  wrote:

     

    I look forward to seeing your results.

     

    DAB

    I've got the first mini-result: set a DIR pin and output a naive pulse train: BeagleBone Control Stepper Motors with PRU - Part 2: Test Driving Outputs

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 6 years ago

    I look forward to seeing your results.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to genebren

    genebren  wrote:

     

     

    ...  Any plans to use micro-stepping? ...

     

     

    The stepper driver supports it - it's not a thing I control in the PRU. You go into the supported microstep mode by giving a SPI commands to a register before sending the pulse train.

    image

    My focus will be on generating the pulse train.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 6 years ago

    Jan,

     

    This looks like a very starting point for your project.  Any plans to use micro-stepping?

     

    Gene

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube