So, what the heck is "phase stepping" ?
In the discussions about VFAs (or belt ripple?) and acoustic noise in the Core One, we keep coming back to "phase stepping calibration". A feature that was introduced in the Prusa XL and apparently helped a lot to avoid resonances in particularly noisy XL units. Prusa developers have stated on Github that "phase stepping is already active on the Core One, but it cannot be calibrated yet".
So I'm wondering: What exactly is phase stepping, and how is it calibrated? The most detailed info I found from Prusa was in a blog post. But that mainly explains the benefits (smoothing out whatever unit-specific tolerances in the stepper motors), not really the technical details.
My best guess so far:
- Stepper motors are used in micro-stepping mode (up to 256 micro steps per full motor step, where a full motor step is either 1.8° or 0.9° of rotation). You increase the current on one motor winding, while decreasing the current on the other, both following a sinusoidal pattern (shifted by 90° between windings).
- But the micro-steps are known not to be evenly spaced, i.e. following that sinusoidal current pattern in equidistant time steps will not result in equidistant micro-rotation of the motor axis. When you intend to drive the motor at a constant speed, you will instead produce small periodic speed variations.
- So I assume that "phase stepping" is a way of driving the motor windings which lets you correct for this unevenness -- either by programming the current curves in a shape that slightly deviates from the nominal sine pattern, or by varying the time steps to be not-quite-equidistant. And "calibrated phase stepping" means that you can determine and optimize either the current curve or the time steps to give the smoothest motor operation.
Does anyone here have more background knowledge on this? Are the above assumptions correct? If so, which correction is actually used -- tweaking the currents or the time steps? Special thanks for any link to a technical document (from Prusa, the Marlin firmware team, or Trinamic maybe?) which you might have!
RE: So, what the heck is "phase stepping" ?
I can't answer your question about what specifically Prusa means, but I can confirm from personal experience that tracking linearity can be improved by modifying the stepping program to account for characteristics of a specific motor. I did this in the context of a 3d-printed altazimuth telescope mount, which I was able to get to track surprisingly well. In that case because I was driving a telescope, I could compute the correction by pointing the telescope at a target and observing how the target moved in the camera image as I drove the stepping motor a specific program of voltages, adjust the program acordingly, and iterate this a few times. (I also had to correct for an unknown nonlinearity due to optics, but I could separate that from the motor nonlinearity because the former was low spatial frequency while the latter was high frequency.)
By the way, I'm not quite sure whether a sine wave is the necessarily best program to use even in the absence of motor irregularities. The crucial thing is that you drive the adjacent windings in a complementary fashion as the rotor moves from one to the next. I did experiment with a few different starting points (e.g. sine wave, sawtooth, etc.), but I don't recall what ended up being the best starting point. But I'm certainly not an expert so maybe there's some good reason to use a sin wave instead of some other shape. Maybe someone can comment on that?
RE: So, what the heck is "phase stepping" ?
I'm also very interested in the technology behind, but only find documentation about what it achieves, not how.
My hunch: the microstepping creates sines for positions between full steps, but using perfect sines only fits mechanics (the positions of poles in the motor) that also is perfect. I suspect that the calibration tests variations of the sine shape to the motor windings (maybe trying to alter the sine to something more triangular in one direction, more rectangular in the other?), and listens to vibrations at the expected frequency with the accelerometer. Then it selects the "sine" variation that gives the least amount of vibration.
This is just a guess, some input from someone who actually knows would be exciting!
RE: So, what the heck is "phase stepping" ?
> But I'm certainly not an expert so maybe there's some good reason to use a sin wave instead of some other shape. Maybe someone can comment on that?
If you use the simplified model of one electrical turn is one mechanical turn, you would probably understand that sine and cosine are the ideal wave forms.
See here:
In the above, you can go full positive current through A, none in B. The magnet moves accordingly. Or full positive in B, none in A. The magnet moves accordingly. And you use trigonometry to get inbetween, just like in any coordinates system.
RE: So, what the heck is "phase stepping" ?
@bruce-lucas @jurgen-7
Prusa mentioned they use Trinamic drivers. The whole things kind of sounds like they started using Trinamic's StealthChop, StealthChop2, maybe SpreadCycle:
https://www.analog.com/en/lp/001/secret-silent-stepper-motor-control.html
RE: So, what the heck is "phase stepping" ?
@bruce-lucas @jurgen-7
Prusa mentioned they use Trinamic drivers. The whole things kind of sounds like they started using Trinamic's StealthChop, StealthChop2, maybe SpreadCycle:
https://www.analog.com/en/lp/001/secret-silent-stepper-motor-control.html
I don't think that this is behind "phase stepping". In my understanding, Trinamic's "stealth chop" deals with the way a targeted motor current (in a given phase of the stepper movement) is controlled via chopping. In contrast, phase stepping seems to be about the sequencing of multiple phases to obtain the smoothest motion.
Without Prusa publishing technical details, "phase stepping" largely remains a marketing term. Maybe someone is enterprising enough to try and reverse-engineer it from the firmware sources? I did take a look a couple of months ago, but could not figure out what is actually happening...
RE: So, what the heck is "phase stepping" ?
Without Prusa publishing technical details, "phase stepping" largely remains a marketing term. Maybe someone is enterprising enough to try and reverse-engineer it from the firmware sources? I did take a look a couple of months ago, but could not figure out what is actually happening...
I seem to recall CNC Kitchen doing a video on this recently. I didn't watch the full video (I intend to) but I believe Stefan was alluding to this but I could be wrong.
RE:
Ah, not CNC Kitchen but "Made with Layers". I'll need to watch it again though.
RE: So, what the heck is "phase stepping" ?
Didnt make any noticable difference on my printer, but I guess it could help to compensate for a large tolerance span, which makes some printers noisy and some not.
RE:
Here's another article on microstepping. My understanding is the root of all this is more precisely adjusting the phase of each microstep. Tomatoe tomato.
Here's another chip makers discussing it:
RE: So, what the heck is "phase stepping" ?
Here's another article on microstepping. My understanding is the root of all this is more precisely adjusting the phase of each microstep. Tomatoe tomato.
That's a good introduction to the general idea of microstepping -- but it does not get into possible imperfections in microstepping mode at all, and hence does not touch on any correction schemes, right?
RE: So, what the heck is "phase stepping" ?
I got into it a while back with my Mk3 and 1.8 degree motors, but honestly never went into the code to tweak the driver firmware. I've forgotten more than I remember. As I recall, non-linearities in the motor meant I was limited from the start. A 0.9 degree motor would do more. As I understood it, you can adjust the phase of the microstep to better compensate for motor currents. But it came with costs and risks: you can "phase adjust" right into the next microstep and essentially break things. You essentially build a 'calibration' waveform you program into the driver that couples to the nominal waveform used to microstep. This compensates for those mechanical non-linearities.
RE: So, what the heck is "phase stepping" ?
Try this ... https://www.analog.com/en/resources/app-notes/an-026.html
RE: So, what the heck is "phase stepping" ?
That all makes sense, and largely corresponds to my starting point in the original post. I would still love to understand what Prusa's "phase stepping" implementation actually does: Does it adjust the timing or the current pattern of microsteps? How does the optimization during the calibration process work -- it probably adjusts/varies the waveform shape gradually (with what degrees of freedom?) and looks to minimize vibrations while moving at constant speed?
It looks like Prusa have not published any technical details, hence an analysis of the firmware sources is probably the only source of information. I was hoping that someone had already done this, since I got lost in that rabbit hole when I took a look...
RE: So, what the heck is "phase stepping" ?
Ah, had not seen your second post while typing my earlier reply. That appnote is a very nice find, and quite likely describes the mechanism which is used in phase stepping. Must be an older Trinamic appnote -- Bernhard Dwersteg is one of the co-founders of Trinamic, and to my knowledge designed their original chips.
RE:
That really sounds like it, especially since Prusa uses trinamic chips. Good find!
Am I wrong to feel a little odd that Prusa would try to frame it like their discovery, if the whole thing really is implemented I Trinamic's chip?
RE: So, what the heck is "phase stepping" ?
That really sounds like it, especially since Prusa uses trinamic chips. Good find!
Am I wrong to feel a little odd that Prusa would try to frame it like their discovery, if the whole thing really is implemented I Trinamic's chip?
Well, there is still the automated calibration (optimization) process -- how do you find the best-matching current curve? It must be based on finding the pattern that gives the smoothest travel at constant speed, measured by the accelerometer. But you have many degrees of freedom there, and may have to fight the limited resolution and background noise of the accelerometer too. So I would imagine that Prusa has put a fair amount of development and tweaking into this.
RE: So, what the heck is "phase stepping" ?
Thinking this over, I'm a bit confused how any calibration waveform would work in application. When a motor is driving a single motion, such as the X or Y direction, the calibration, or error signal, is straight forward. When those axis are driven by two motors with a semi random correlation as they are in a CoreXY, you have two distinct waveforms that must be overlaid more or less randomly depending on the initial point of the move.
As far as I know, and the few drivers I've looked at, make no attempt to allow on the fly modification to the lookup tables that would enable application of a summed correction signal based on two motor curves. The controllers, I'd think, would need to be able to pass positional info between themselves, and have a table 256x256 in size.
Interesting problem though.
RE: So, what the heck is "phase stepping" ?
But if you calibrate both motors separately to vibrate less... The total result is less vibration. Whatever what the print head does when a single motor moves.
RE:
I'm not so sure that is a true statement. Resonance from three discrete sources (five, actually, plus the frame) is your classic three body problem: unknowable. In fact, the two motors we are concerned with may interact in ways that preclude the calibration being helpful at all. They are not independent, and calibrating one does not ensure it "does better" because the other motor is acting on that motion.
Just being the devils advocate here. It may be easy enough to try it out, and if it gives better results in your situation, great. But I have low expectations there will be a quantifiable improvement. But I am open to surprises.
