element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BeagleBone Control Stepper Motors with PRU - Part 1: Intentions
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
BeagleBoard requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
Author: Jan Cumps
Date Created: 23 Jul 2019 3:06 PM
Views: 633
Likes: 10
Comments: 4
  • 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 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

 

  • 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
Anonymous

Top Comments

  • Jan Cumps
    Jan Cumps over 2 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 O…

  • Jan Cumps
    Jan Cumps over 2 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 2 years ago +1

    I look forward to seeing your results.

     

    DAB

  • Jan Cumps
    Jan Cumps over 2 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
    • Up +2 Down
    • Reply
    • More
    • Cancel
  • DAB
    DAB over 2 years ago

    I look forward to seeing your results.

     

    DAB

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 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.

    My focus will be on generating the pulse train.

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • genebren
    genebren over 2 years ago

    Jan,

     

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

     

    Gene

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube