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
Community Hub
Community Hub
Member Blogs Clem's Stepper Motor Puzzle!
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Community Hub to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mayermakes
  • Date Created: 2 Feb 2023 4:07 PM Date Created
  • Views 27528 views
  • Likes 16 likes
  • Comments 43 comments
  • stepper motor
  • puzzle
Related
Recommended

Clem's Stepper Motor Puzzle!

mayermakes
mayermakes
2 Feb 2023
Clem's Stepper Motor Puzzle!


Developing electronic circuits often feels like solving a puzzle. And solving this puzzle could win you a Multicomp Pro Tablet Oscilloscope!


And while finding the basic application to make an IC do its magic is often quite easy, some questions often remain.
Among the crucial skills of makers and engineers is interpreting a datasheet and this will come in very handy for the following puzzle:

This time we are looking at a staple of the 3d printing and CNC world:  the TMC2130 stepper motor driver.


imageimage

The photo and schematic show a basic circuit that allows the user to control the movement of a bipolar stepper motor with simple button pushes.
For practical reasons the built circuit has the enable pin(EN) pulled low to activate the circuit.  The Arduino is only used to pass on 12V, 5V and GND to the tmc2130, it has not other connections to the circuit.
Pulling the DIR pin high or low determines the direction of the motor movement.
Pulsing the STEP pin makes the motor move.
But how far does the motor move?

The pins MS1, MS2,MS3 (also known as CFG0,CFG1,CFG2) determine the movement settings; the most widely used configuration is to pull all 3 of them low.
CFG2 determines where to get the voltage reference from. Low level sets it to internal.
The other two pins are much more interesting.
By pulling MS1/CFG0 and MS2/CGF1 low, we set the driver to "Full step," no interpolation and spreadcycle mode.
The most common stepper motors need to do 200 steps per revolution (1,8° angle change per full step).
So for a full rotation we need to press the step button 200 times.

So far so good.

Here is the puzzle:
What happens if you just leave MS1/CFG0 and MS2/CFG1 floating (open) -- how often would you have to push the STEP button for a full rotation?

Or do you think the motor would just not turn at all?

You can find the solution in theory and practice!  We are interested in not only getting the answer right but in seeing the work you did to arrive at this answer.

Tell us if you tried you try it out practically (show us pictures). Or did you study datasheets or video tutorials (share the links you found helpful)?

The member who provides the best detail on how he or she solved the puzzle wins the prize!

Terms and Conditions  Multicomp Pro Tablet Oscilloscope

  • Sign in to reply

Top Comments

  • mayermakes
    mayermakes over 3 years ago +4
    https://youtu.be/4N-O1IzRSfc Lets go over the main aspekts of the entries for this competition and find out who is the winner!(TLD:DR skip to the end if you just want to know who won) The element14 community…
  • beacon_dave
    beacon_dave over 3 years ago +3
    The motor won't turn at all as Clem appears to have forgotten to plug the Arduino into a power supply...
  • misaz
    misaz over 3 years ago in reply to mayermakes +3
    Thank you for sending it. Yesterday it arrived and I am playing with it. Fundamental signals are well shown. More details I will post in blog soon.
  • misaz
    misaz over 3 years ago +2
    Hello Element14 community. Today I completed my practical part of this puzzle, and I would like to post my solution. In recent two weeks I did theoretical analysis and two practical experiments. The…
  • mayermakes
    mayermakes over 3 years ago +2
    thank you all for your Entries! it has been a blast seeing how this puzzle challenge played out with a lot of different approaches to finding the solution! We will carefully review all the entries, even…
  • Siana
    Siana over 3 years ago +1
    Trick question! Pololu does not manufacture a TMC2130 breakout. Pololu SKU 2130 is an entirely different thing, a brushed driver module. So that's a Waterrott 2130 stick there. The pins are connected…
  • rsjawale24
    rsjawale24 over 3 years ago in reply to dougw +1
    I would love to do the experimental analysis as theory often needs to be validated using experiments. But I do not have the resources and currently I'm running on a tight schedule. Maybe someone can do…
  • rsjawale24
    rsjawale24 over 3 years ago in reply to misaz +1
    Nice! I always love to see practical applications!
  • mayermakes
    mayermakes over 3 years ago in reply to misaz +1
    Hope you get great use out of your shiny new gadget!
  • misaz
    misaz over 3 years ago in reply to mvischioni

    Your idea is correct but schematic is misleading a little and Clem later specified that EN is pulled permanently low. Note that on the photo are only two buttons while schematics has three.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mvischioni
    mvischioni over 3 years ago

    Interesting puzzle!

    By leaving CFG0, CFG1, CFG2 open we configure the driver as "16 microsteps, interpolation to 256 microsteps, stealth chop", with a "chopper off time" of 332 clock periods.
    So we need 16 pulses to make a full step, assuming 1.8°per step we need 3200 pulses to complete a revolution.
    STEP, DIR and ENABLE pins are connected to tactile switches and pullups.
    Default active edge is the rising edge, so the step occours at button release.
    ENABLE (CFG6) pin is active low: we need to keep the button pressed to enable the driver.

    If we only press the STEP button, the motor won't turn at all.

    References:
    www.trinamic.com/.../TMC2130_datasheet.pdf
    www.trinamic.com/.../TMCSilentStepStick_SPI-TMC2130_v10.pdf
    learn.watterott.com/.../

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • luislabmo
    luislabmo over 3 years ago

    Oopsie, my puzzle solution comment went into moderation Cold sweat

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • luislabmo
    luislabmo over 3 years ago

    I tried to tackle this puzzle for several days and came to the conclusion that solving this puzzle requires some assumptions made -there are a few unknown variables that are very important and may affect the outcome-. I will explain in detail.


    Looking at the Puzzle’s description

    • The Arduino Mega is there to show how Power and GND are connected to the stepper driver and has no other connections to the circuit. This also tells us that there is no software debounce for any input
    • There is no mention of a hardware debounce in the Puzzle description, the practical example or in the Puzzle schematic but, there is an internal analog filter in the Step and Dir inputs. The datasheet mentions that this filter is designed to help with normal noise in the circuit but doesn’t seem designed to filter noise generated by push-buttons
      Input Filter
    • The Stepper is enabled
      Enable pin
    • The Motor requires 200 steps per revolution
    • From the puzzle description, CFG0 and CFG1 are left open
      CFG0 and CFG1 left open (floating)

    • CFG0 left open sets the duration of Slow Decay Phase to 332 clock cycles or around 25µ sec (internal clock is around 13.2MHz under normal temperature operation), this doesn’t affect the outcome of the puzzle IMO
    • There is no mention of the state of CFG2 in the Puzzle -or well, it is incorrectly mentioned
      Incorrect CFG2 description
      In the Datasheet, CFG3 is actually the input that sets mode of the current setting, GND sets it to Internal reference voltage. CFG3 I consider irrelevant for the puzzle solution as well

    So what about CFG1 and CFG2 then?. Before continuing we have to make some assumptions which are nowhere clarified in the puzzle or any of the supporting images:

    Let's assume that the Stepper Driver is correctly set up in Standalone mode (SPI_MODE = 0 or connected to GND), which I believe is what Clem is attempting considering he mentioned MS1/MS2/MS3 as a way to configure the stepper and part of the description of the puzzle and also mentions configuration pins in different states (low, open)

    Based on the above, if CFG1 is left open the number of steps per revolution has 3 possible values, each dependent on the state of CFG2 which again, is not mentioned precisely in the Puzzle description. We can ignore Interpolation for the calculations as this is just how the stepper-driver smooths internally each step

    CFG1 and CFG2

    • If CFG2 is connected to GND then 400 steps are required per revolution (2 half steps per step * 200 steps per revolution)
    • If CFG2 is connected to VCC_IO then 800 steps are required per revolution (4 micro-steps * 200 steps per revolution)
    • If CFG2 is left open then 3200 steps are required per revolution (16 micro-steps per step * 200 steps per revolution)

    From the table above we can see something very important to solve the puzzle later on. Note that no matter the state of CFG2, if CFG1 is left open, the 3 possible values are always in terms of microsteps (2 half-steps, 4 quarter-steps or 16 microsteps) and Interpolation is always Active (Interpolation = Y).

    How many OR how often?

    Let’s see the Puzzle question in detail because I believe here is where things get a little spicy on purpose

    The puzzle question

    I usually see a “how often” question answered with things like “every 15 minutes”, “daily”, “every other week”, etc., so lets double-check that:

    How often from Google

    Since we are in an electronics community and this is a puzzle is about electronics, I also verified “frequency vs period” and here with the important part highlighted:

    frequency vs period

    At this point, I’m pretty much convinced that the answer to the “how often” of this puzzle has to be in terms of Frequency and not in terms of a quantity (how many).

    To answer the “how often” of the puzzle, we need to look at a few more places in the Datasheet. First, let's take a look at the timing section, which tells us that the Step input can operate at a maximum of ½ the frequency of the TMC2130 clock. See the image below

    image

    We can safely assume that dedge=0 is the only possible scenario; remember that all over the puzzle Clem is trying to tell us that he is trying to operate the stepper driver in Standalone mode (the MS# pin mentions, no IO connection to the Arduino, CFG# pins left open) and dedge=1 can only be possible by setting the 0X6C CHOPCONF - Chopper Configuration register which can’t be done in Standalone mode, it can only be done in SPI Interface mode.

    CHOPCONF register


    So, how often then?

    From the timing characteristics in the datasheet, the internal clock is the option that makes more sense to me -also there is no mention of an external clock in the puzzle. I also think that a 50°C TJ (Operating Junction temperature) is a safe bet.

    image

    With all of the information presented so far, this leaves us with the answer to the puzzle:

    What happens if you just leave MS1/CFG0 and MS2/CFG1 floating (open) -- how often would you have to push the STEP button for a full rotation?

    When operating at maximum micro-step resolution, the STEP button can be operated at a maximum of ½ the frequency of the TMC2130’s internal clock (13.2 MHz/ 2) or as fast as every ~152ns (0.15µs) in the best case scenario (no bounce or missed actuations in the switch and when operating with the internal clock at around ambient temperature).


    What if how many?

    Answering how many times the Step button has to be pushed introduces more unknown variables and several possible answers to the puzzle, here are a few factors to consider:

    • Are we working “theoretically” with a perfect switch?
    • If we have to consider switch bounce, the amount of noise varies by switch
    • Should we assume the motor is under no load?
    • Should we assume the motor won’t miss any steps?
    • When working with stepper motors, the higher the VMOT, the better the motor will respond -this is one of the main objects of a chopper-type driver (more torque, potentially faster response time and potentially less missed steps)
    • We know VMOT is 12V (from the puzzle’s description) but we don’t know how well the stepper will respond to this voltage

    Just take into consideration the following example:

    In a best case scenario (no switch bounce and no missed steps), if CFG0, CFG1 and CFG2 are left open, the Step switch has to be pushed 3200 times for a full revolution (16 micro-steps per step * 200 steps per revolution):

    • If we introduce missed steps from the motor, the value goes up
    • If we introduce switch bounce, the value in most cases goes down
    • Combine the two above and we can only provide an exact answer (3200 times) for the best case scenario


    Other possible solutions to the puzzle

    Since I mentioned other possible solutions when looking more closely at every detail of the puzzle, I will cover them too.


    The TMC2130 operation mode

    The TMC2130 has a few operation modes based mostly on how the SPI_MODE is configured. Some youtubers point out that the TMC2130 Stepper Driver’s default operation-mode varies by brand. Here is another youtuber highlighting the same.

    There is no mention about the SPI jumper-pad in the puzzle. I can only assume that Clem is actually using the watterott TMC2130 pictured in the practical example (the breadboard prototype picture), on which the jumper-pad is not visible in the Breadboard picture but Stepper Driver datasheet shows it at the bottom of the PCB,

    SPI Mode solder pad

    This manufacturer states that the factory’s default state of the SPI jumper is left Open -see the image below-.

    image


    Standalone operation

    To Solve the puzzle for Standalone operation, we have to assume that the Stepper Driver is correctly set for Standalone operation by bridging the SPI solder-jumper, in this case SPI_MODE=0 (connected to GND) -again, the puzzle doesn't mention this.

    image

    The Standalone operation mode is seen in good detail in the TMC2130's Datasheet

    image

    In standalone operation, the interface pins of the stepper driver act in a TRISTATE detection (they can be connected to GND, VIO or left OPEN).

    The Watterott TMC2130 Datasheet shows that the CFG4 and CFG5 are connected to GND but I consider them irrelevant for the puzzle solution

    CFG4 and CFG5

    • CFG4 is connected to GND (sets chopper hysteresis to 5)
    • CFG5 is connected to GND (sets the Chopper Blank Time to 16 clock cycles)

    From the puzzle’s description and the practical example we also know that CFG6 is connected to GND which is an Active LOW input, indicating that the stepper-driver is enabled but here we have to ignore the fact that the ENABLE pin is Pulled-Up in the Puzzle’s schematic.

    image

    The rest of the solution to the puzzle in Standalone operation is already covered.


    SPI Mode

    According to the manufacturer, this mode of operation is the default operation mode of the watterott TMC2130, seen in good detail in the STEP/DIR application diagram -pictured below 

    image

    From now on, I will assume Clem left this solder-pad in unbridged (Open). In that order, the TMC2130 will operate in Step/Direction Driver Mode and SPI Interface (considering that in the TMC2130's Datasheet SPI_MODE has a pull-up Resistor so SPI_MODE=1)

    SPI_MODE input

    Clem’s practical example

    Taking a closer look at Clem’s practical example only (the picture of the Breadboard prototype which I have added again with labels) and assuming power is actually connected to the DC Power Input of the Arduino Mega Smiling imp then:

    image

    • The Stepper Driver is enabled for operation (ENABLE is connected to ground and is also stated in the Puzzle’s description)
    • SPI_MODE=1 tells me that the Interface pins will operate in SPI Mode (not in the 3-state configuration mode) -again, I’m assuming this solder-jumper was left open
      TMC2130 SPI Pins

    • From the Breadboard picture then:
      • SDI and SCK are connected to GND
      • CSN and SDO are left open, but these have pull-up resistors when not working in tristate-detection -see the “(tpu)” in the datasheet picture above, so CSN and SDO are Pulled-up to 5V.
      • CSN is the Slave Select input on a Serial communication, which is Active LOW, so unless this connected to GND, this driver will ignore any incoming serial data

    According to the getting started section of the TMC2130's Datasheet, the TMC2130 needs initialization when operating with SPI Interface

    image

    And here is another place from the datasheet that confirms that the registers are reset on power-up

    image

    Based on the information presented, if Clem is using the watterott TMC2130 stepper driver with the SPI solder-jumper left Open, the answer to the puzzle in this case is “the motor won’t turn at all”. 

    This makes total sense since to operate any stepper-driver, at minimum the current-limit needs to be set, which in this case needs to be configured via SPI (0x10 IHOLD_IRUN - Driver current control register).

    And here is a small demo, where I try the Stepper Driver as is from the factory (SPI Interface). There is no movement from the motor and also no voltage at one of the coil's output because it hasn't been initialized

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


    The confusing things of the puzzle

    I found a few misleading things in the puzzle that maybe Clem left there for a reason, either way I’ll cover some of them


    Taking a look at the Schematic only

    image

    • All the switches are NO (Normally Open) and Pulled-Up
    • The ENABLE input is Active LOW (see the stepper driver symbol) and the Enable Switch (SW3) is Pulled-Up… just looking at this part, unless you push and hold the Enable  switch (SW3) before pressing the Step switch (SW2), the motor won’t move
    • In the puzzle’s description nowhere is stated what is the state of the Enable Switch (SW3) but, there is mention of the Enable signal connected to GND for practical purposes, this discards the previous bullet
    • We can also see in the schematic that all the interface pins have their SPI Interface names -one can think ok we are in SPI mode-, but the puzzle description references the Interface pins by their Standalone configuration names -see image below for comparison-, so we don’t know exactly in which Interface mode the stepper is operating when putting all the puzzle's information together
      image

    • We can also see that the pin numbers and the question marks referencing MS1/SDI, MS2/SCK and MS3/CS match precisely the Pololu A4988 pinout. The puzzle precisely mentions MS1/CFG0 and MS2/CFG1 left floating (open) but, on a careful comparison these don’t precisely match -see the image below where I have added pin-numbers matching the Puzzle’s schematic
      A4988 pinout comparison


    If we put all of the above together, perhaps the real answer to the puzzle is that the motor won't turn at all because Mr. Clem failed spectacularly at translating the schematic into the Breadboard Joy

    Jokes aside, thank you so much for this puzzle!. I really enjoyed trying to solve the puzzle and learning about the TMC2130 which I will certainly consider in future projects with stepper motors. 

    Luis

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • luislabmo
    luislabmo over 3 years ago in reply to dougw

    In theory considering how stepper motors work, yes!. In practice, stepper drivers can drive at different current values in certain events; the most common are Run Current and Hold Current. The TMC2130's Datasheet states that driver will switch to IHOLD (Hold Current) after 2^20 clock cycles after the last STEP pulse.

    image

    So according to the Datasheet, the minimum frequency required to operate the motor at Run Current (IRUN) without it switching to Hold Current (IHOLD) is roughly the Frequency of the Clock / 1million (~2^20 clock cycles) -see below

    image

    • 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