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
Industrial Automation
  • Technologies
  • More
Industrial Automation
Blog Stepper Motor Control with Hercules High-End Timer - Part 2: Stepper Controller and MSP430 Firmware
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Industrial Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 28 May 2017 9:32 PM Date Created
  • Views 2815 views
  • Likes 6 likes
  • Comments 8 comments
  • stepper_motor
  • stepper_driver
  • stepper_controller
  • texas_instruments
  • msp430
  • hercules
  • launchpad
Related
Recommended

Stepper Motor Control with Hercules High-End Timer - Part 2: Stepper Controller and MSP430 Firmware

Jan Cumps
Jan Cumps
28 May 2017

I'm trying to control an unknown stepper motor with the high-end timer (NHET) module of a Texas Instruments Hercules microcontroller

image

I got a freebee from TI almost a year ago. An unknown stepper motor, a driver board and a Hercules RM57 LaunchPad. The code to run the motor was expected to arrive too (it was an assignment for an internal) but that never materialised. In this blog series I'm trying to program the NHET module so that it sends the right signals to make the stepper step.

 

 

In the second post I analyse the example program for the MSP430 microcontroller and try to link it to the datasheet of the controller.

 

 

Stepper Motor Controller

I'm using a DRV8711DRV8711. Its main purpose is to control a stepper (although it can also act as a 2 DC motor driver).

image

source: datasheet

 

The behaviour of the IC is controlled via SPI. You can set various parameters such as the step divider (allows you to take micro steps down to 1/256 of a step) and speed-up /wind-down profiles.

One of the more challenging attributes is the blanking time. If that's applied smartly, you can have a smooth rotating stepper motor.

All configurations are register based and programmable via that SPI interface.

The datasheet for the DRV8711 explains this in much detail. But it's easier to use the demo application for the BoosterPack. It shows on-screen what values are set i  the register.

You can see - and change - how the motor behaves and validate the register settings directly in that app.

image

source: BoosterPack demo app connected to an MSP430G2 LaunchPad

 

Understand the FirmWare

For me, as a non-MSP430 expert, cracking the firmware is like resolving an enigma. I have the code and it has comments telling what's done - roughly.

Still it takes significant time unraveling the underlying functionality. It's not my specialty - and if I'm trying to both understand code flow while not knowing the registers yet. I have a hard time.

I may take a shortcut and put a logic analyser between controller and chip. That way I understand better when SPI is used and when there's a pulse train coming from the PWM module.

 

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

 

What I've detected so far is that there are 3 timers set up. A0, A1 and the watchdog.

Interrupts are captured for the timers, for some GPIO pins (I think Fault and Stall), ADC, serial (for communication with the GUI running on the PC or for DPI?) and for a comparator.

 

A thing that I can certainly reuse is the SPI module. The settings are fairly easy to understand and the program structure is clear for SPI.

Whenever it comes to the logic applied to accelerating, de-accelerating and pulsing steps to the controller, it becomes more fuzzy.

It seems that the watchdog timer is involved in that, in combination with at least one generic timer that gets reprogrammed during the rotations.

I'll need to find out how that works. With the code and logic analyser at hand - I may have to pull in one of my MSP430-savvy friends when needed.

 

Related Blog
Part 1: Hardware Overview
Part 2: Stepper Controller and MSP430 Firmware
Part 3: SPI Commands and Pulse Control
Part 4: Analyse MSP430 PWM Step Signal
Part 5: Hercules RM57 Hardware Provisioning
Part 6: Hercules RM57 SPI
Part 7: HET Assembly Language Test
Part 8: HET Based Pulse Train Output
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 8 years ago +2
    Pulse from 128 PPS to 512 PPS, accelerate rate 128 PPSPS Diagram of timestamp of each switch transition. From steep to almost linear (sample time of my analyser was exhausted before linearity was reached…
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to DAB +2
    I haven't, Don (although I have no reason to doubt it in my almost optional setting: perfectly driven according to motor specs and no load). I'll port this to the Hercules microcontroller's high-end timer…
  • DAB
    DAB over 8 years ago +1
    Nice update Jan. You have increased my interest. Maybe it would be useful for you to do some software breakout in a post and share some of the code and the issues you find difficult. Maybe some of us can…
Parents
  • Jan Cumps
    Jan Cumps over 8 years ago

    Some SPI captures for the next blog - initialising the driver.

    A result from pressing the Set All button with below settings:

    image

    Logic Analyzer capture:

    image

    Protocol analysis:

    image

    One of the things I noticed is that SPI chip select is active high ...

     

         

    indexstart-timeend-timeevent?event-typeMOSI dataMISO data0-1,66??s-1,66??strueCS_LOW120,00?ns20,00?nsfalse3865220,00?ns20,00?nsfalse6553539,92??s9,92??strueCS_LOW412,24??s12,24??strueCS_HIGH513,68??s13,68??sfalse4282613,68??s13,68??sfalse65535723,82??s23,82??strueCS_LOW826,14??s26,14??strueCS_HIGH927,82??s27,82??sfalse82401027,82??s27,82??sfalse655351137,70??s37,70??strueCS_LOW1240,04??s40,04??strueCS_HIGH1341,46??s41,46??sfalse125521441,46??s41,46??sfalse655351551,60??s51,60??strueCS_LOW1653,94??s53,94??strueCS_HIGH1755,62??s55,62??sfalse171681855,62??s55,62??sfalse655351965,50??s65,50??strueCS_LOW2067,46??s67,46??strueCS_HIGH2168,76??s68,76??sfalse243842268,76??s68,76??sfalse655352378,64??s78,64??strueCS_LOW2481,54??s81,54??strueCS_HIGH2582,90??s82,90??sfalse246612682,90??s82,90??sfalse655352792,72??s92,72??strueCS_LOW2896,64??s96,64??strueCS_HIGH2998,06??s98,06??sfalse286723098,06??s98,06??sfalse6553531108,20??s108,20??strueCS_LOW
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Jan Cumps
    Jan Cumps over 8 years ago

    Some SPI captures for the next blog - initialising the driver.

    A result from pressing the Set All button with below settings:

    image

    Logic Analyzer capture:

    image

    Protocol analysis:

    image

    One of the things I noticed is that SPI chip select is active high ...

     

         

    indexstart-timeend-timeevent?event-typeMOSI dataMISO data0-1,66??s-1,66??strueCS_LOW120,00?ns20,00?nsfalse3865220,00?ns20,00?nsfalse6553539,92??s9,92??strueCS_LOW412,24??s12,24??strueCS_HIGH513,68??s13,68??sfalse4282613,68??s13,68??sfalse65535723,82??s23,82??strueCS_LOW826,14??s26,14??strueCS_HIGH927,82??s27,82??sfalse82401027,82??s27,82??sfalse655351137,70??s37,70??strueCS_LOW1240,04??s40,04??strueCS_HIGH1341,46??s41,46??sfalse125521441,46??s41,46??sfalse655351551,60??s51,60??strueCS_LOW1653,94??s53,94??strueCS_HIGH1755,62??s55,62??sfalse171681855,62??s55,62??sfalse655351965,50??s65,50??strueCS_LOW2067,46??s67,46??strueCS_HIGH2168,76??s68,76??sfalse243842268,76??s68,76??sfalse655352378,64??s78,64??strueCS_LOW2481,54??s81,54??strueCS_HIGH2582,90??s82,90??sfalse246612682,90??s82,90??sfalse655352792,72??s92,72??strueCS_LOW2896,64??s96,64??strueCS_HIGH2998,06??s98,06??sfalse286723098,06??s98,06??sfalse6553531108,20??s108,20??strueCS_LOW
    • Cancel
    • Vote Up 0 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