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
    About the element14 Community
  • 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
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Stepper Motor Control with Raspberry Pico PIO and DRV8711 driver- Part 3: GPIO
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 3 Apr 2025 6:37 PM Date Created
  • Views 1164 views
  • Likes 7 likes
  • Comments 8 comments
Related
Recommended
  • pico
  • pico_eurocard
  • PIO

Stepper Motor Control with Raspberry Pico PIO and DRV8711 driver- Part 3: GPIO

Jan Cumps
Jan Cumps
3 Apr 2025

The Pico has a set of PIO co-processors. They are real-time controllers that can execute logic with deterministic timing. Ideal to run strict-timed sequences and state machines. And to implement extra peripherals.
In this series, I'm trying to use the PIO to control a TI DRV8711 stepper motor controller.

image

Follow up of  Stepper Motor Control with Raspberry Pico PIO and DRV8711 driver- Part 2: SPI .

Next to power, the driver IC has some digital inputs that we need to entertain. This post is my doco on how I connected them. Very short, nothing real happening here.
These are the Pico resources I reserve:

signal DRV8711 Pico
direction DIR

IO4

step STEP

IO5

sleep SLEEP

IO14

reset nRESET

IO15

power

3V3

ground

GND

All are outputs, Here's the code to set them. And a little helper.

#define NSTALL (-1)
#define NFAULT (-1)
#define NSLEEP (14)
#define RESET (15)
#define DIR (4)
#define STEP (5)

// ...

void init_drv8711_hw() {
    // nStall and nFault as input
    // not used
    // gpio_init(NSTALL);
    // gpio_set_dir(NSTALL, GPIO_IN);
    // gpio_set_pulls(NSTALL, true, false); // drv8711 outputs are open drain
    // gpio_init(NFAULT);
    // gpio_set_dir(NFAULT, GPIO_IN);
    // gpio_set_pulls(NFAULT, true, false); // drv8711 outputs are open drain
    
    // nSleep and Reset as output
    gpio_init(NSLEEP);
    gpio_put(NSLEEP, 0);
    gpio_set_dir(NSLEEP, GPIO_OUT);
    gpio_init(RESET);
    gpio_put(RESET, 0);
    gpio_set_dir(RESET, GPIO_OUT);
    
    // bin1 and bin2 as output
    // not used
    
    // DIR and STEP as output
    gpio_init(DIR);
    gpio_put(DIR, 0);
    gpio_set_dir(DIR, GPIO_OUT);
    gpio_init(STEP);
    gpio_put(STEP, 0);
    gpio_set_dir(STEP, GPIO_OUT);
}

void sleep(bool yes) {
    gpio_put(NSLEEP, yes? 0 : 1);
}

In main(), the pins are set. Before the logic, the driver is is woken up. At that time, a blocking current flows, that holds the motor in place.

When all done, we release that motor lock and send the driver to sleep again:

int main() {
    // ...
    init_drv8711_hw();
    // ...

   sleep(false);
   
   // business ...
   
   sleep(true);

    return 0;
}

Next post: PIO and putting it all together.
Thank you for reading.

  • Sign in to reply
  • Jan Cumps
    Jan Cumps 11 months ago

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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 11 months ago in reply to DAB

    next post is about the Pico PIO controllers. A bit more involved.
    Luckily, it's a simple example: creating a pulse train with count x.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB 11 months ago

    Nice and simple.

    • 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 © 2026 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