element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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 5: It Works
  • 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: 2 Aug 2019 5:58 PM Date Created
  • Views 2546 views
  • Likes 5 likes
  • Comments 4 comments
Related
Recommended

BeagleBone Control Stepper Motors with PRU - Part 5: It Works

Jan Cumps
Jan Cumps
2 Aug 2019

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.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

Initialise the Sleep and Reset Signals

 

The pins P9_11 and P9_13 are used. I'm controlling them from the Linux command line.

 

BB MUXBB P9Driver function
GPIO_3011nSleep
GPIO_3113Reset

 

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

 

Set the PRU MUX signals and Load PRU Firmware

 

See the post on pin assignments for the PRU. I'm assuming that you created the binary in this post.

 

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 

 

Initialise the Stepper Motor Driver via SPI

 

I'm assuming that you installed the SPI overlay as explained in this post and created the binary in this post.

 

/home/debian/bin/bb_LINUX_STEPPER_SPI

 

 

Wake Up the Stepper Motor Driver

 

# sleep off

echo 1 > /sys/class/gpio/gpio30/value

 

At this point everything is prepared, and you are ready to ....

 

Tell PRU to Step the Motor

 

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.

 

Motor Heat

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 

 

 

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

  • DAB
    DAB over 6 years ago +1
    Great finish Jan. DAB
  • Jan Cumps
    Jan Cumps over 6 years ago +1
    The evaluation software for the DRV8711 stepper motor controller kit is very good. You can use it to test the driver IC (you need a MSP-EXP430G2 MSP-EXP430G2 LaunchPad but that one is cheap) You can set…
Parents
  • DAB
    DAB over 6 years ago

    Great finish Jan.

     

    DAB

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

    Great finish Jan.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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