How fast can it go?

I get a lot of questions about performance of grblHAL vs Grbl Classic. Sometimes the question asked is drenched in skeptical tones. While a little rude, it is quite understandable given Grbl running on an 8-bit Arduino is severely limited by the hardware. Step rates are the most common question and 8-bit Grbl could barely muster a 30 kHz step rate. This forced a trade off between resolution (how far you can go in 1 step) and speed. Considering most stepper drivers today are specified to be able to take a maximum step rate of 200 kHz and I think you can see why there is some skepticism towards grblHAL. But a system based on ARM processors should be able to do a lot better.


A while ago I did some step rate testing with an oscilloscope on my Teensy 4.1 based grblHAL breakout board. I was able to see step rates at 160KHz but going beyond that rate the scope display turned to mush. So, I was not able observe (and claim) a much higher rate and that is what I specified for the breakout board. However, I knew that my scope probes were not the highest quality and suspected the breakout board could go higher. 160KHz is nothing to be ashamed of and probably does not limit any of my customers. So, I left it at "good enough" for now.

But, I really wanted to know where the limit was. Fast forward to today. Using a logic analyzer, I was able to make some better measurements. And, for the TL;DR crowd, there is great news, I can see 400 kHz step rates - twice as fast as most stepper drivers are capable of. Perhaps the most amazing, it is quite a bit faster than what most professional CNC motion controller manufacturers claim.


In order to measure step rate speeds, I needed to configure grblHAL in such a way to force it to output very high step rates. There are several parameters that affect this: Step pulse time ($0, set to 2 microseconds), Axis Travel Resolution ($100, $101, $102 and $103 for X, Y, Z and A, respectively), Axis maximum rate ($110, $111, $112 and $113, for X, Y, Z and A respectively) and Axis Acceleration ($120, $121, $122, & $123). These settings are easily changeable by any user. I am using Axis X for this test but the other Axes behave the same.


One thing to understand about CNC stepper motor control is that you can't start out at an arbitrarily high rate. Just like an automobile, you have start slow and ramp up. This is where the Acceleration setting comes into play. Here is a trace from the logic analyzer. It shows how grblHAL starts slowly and accelerates to the top speed. The line that is labeled Step Pulse shows a series of pulses. Each one causes the motor to make one step (or microstep, if the driver is configured for that). Note that the image is a screen shot and suffers from aliasing so, while it may look a little uneven, it actually is smooth. In this trace you can also see the Direction and Enable pins in action. This trace is the result of sending grblHAL the following command: g91 g0 x-0.2 (incrementally move X -0.2 mm at the fastest possible speed). Acceleration makes it a bit tricky to find the fastest step speed. Also, you can see that for short moves, the machine only runs at the fastest rate for a small portion of the time.


So, first, lets see if we can run at 150 kHz. I set steps per mm to 1500. I also set the feed rate to 6000 mm/minute which gives us 100 mm per second. Steps per mm times mm per second predicts a 150 kHz step rate. Acceleration is set to 5000 mm/second squared (a very unrealistic number but will make it more likely to reach top speed). One other thing I needed to set is Step pulse time - the actual width of the step pulse. The default is 10 microseconds which limits us to less than 100 kHz. I set it to the minimum - 2 microseconds. Then I commanded grblHAL to move -2 mm (g91 g0 x-2). See the trace below. It is zoomed into the middle of the pulse sequence and shows 149 kHz. Pretty close and within the accuracy of the tools we are using.



Let's see if we can play with the big boys at 200 KHz. To do that I set $100 to 2000 step/mm and keep $110 at 6000 mm/min. This predicts a step rate of 200 kHz. I used a logic analyzer to capture the X Axis step output pin signal. If you look at the trace you will see that waveform has a frequency of 198.4 kHz. Close enough.



So, how fast can it go? 300 kHz? That would be 3000 Steps/mm and 6000 mm/min. 295.9 kHz. Pretty close.



400kHz? That would take 4000 steps/mm at 6000 mm/min. And the result? 393.7 kHz. Not bad. For grins, I tweaked the numbers a bit (4068 steps/mm) and got the second trace - 400 kHz exactly. At this point, testing further is not worth it because, with a 2 microsecond step pulse width, 500 kHz is not possible. At 400 kHz grblHAL is 2X the typical max step rate of commercial stepper drivers. This definitely isn't Kansas anymore, Toto.




More information on grblHAL



Featured Posts
Posts Are Coming Soon
Stay tuned...
Recent Posts
Search By Tags
No tags yet.
Follow Us
  • Facebook Classic
  • Twitter Classic
  • Google Classic
  • Wix Facebook page
  • Twitter Classic
  • Google Classic