Hello everyone,
I would like to share some intermediate benchmarking results regarding motion controller latency. For this test, I used an STM32F407VET6 MCU running on an MKS Monster8 V2 board. Instead of moving to alternative platforms, I decided to build upon the existing Smoothieware core. My custom firmware is based on the janm012012 / Smoothieware-CHMT fork, into which I backported advanced motion concepts from the markmaker / Smoothieware repository (feature/best-for-pnp branch), along with several low-level optimizations.
Key features implemented in this build:
- Compiled with the maximum optimization level, stripped of all unnecessary modules (extruder, temperature control, panels, etc.) to keep the main loop completely lightweight.
- Moved critical text parsing and step-generation routines directly into fast internal RAM execution.
- Established a direct hardware TTL link to the host PC via an internal PCIe-to-UART card (WCH382), running at a stable 921,600 baud with full RTS/CTS hardware flow control.
Bandwidth Stress-Test Context:
To evaluate the absolute throughput limits of the MCU parser, I initially flooded the planner with a dense array of micro-segments using Simulated3rdOrderControl. At ~1 Mbps bandwidth, transmitting this extreme amount of textual commands physically requires 54 ms of pure cable transfer time. Naturally, this would introduce an immense 54ms+ startup latency before the axis actually starts moving.
To decouple the serial transfer bottleneck from the execution start, a minor modification was made in Conveyor::check_queue:
if (blocks_in_queue >= 2 || force)
This allows the motion planner to open the gates and trigger physical movement immediately upon receiving the first two G-code lines. The remaining micro-segments continue to stream seamlessly into the DMA ring buffer in the background while the machine is already moving, turning a slow sequential serial bottleneck into a highly parallel pipeline.
Instrumental Measurements (Logic Analyzer @ 100MHz):
To measure the real-world command junction latency, I executed a motion profile consisting of multiple segments separated by M400. In this scenario, the total idle pause between the bursts of STEP pulses on the analyzer captures the entire loop overhead: the time required for the controller to report the coordinates of the completed move (M114 logic), the host processing time, the cable transmission time of the next incoming command package, and the clean cold-start execution latency of the MCU:
- Stock Smoothieboard v1 (LPC1769 via USB VCP): 4.8 ms total idle pause (~3.0 ms clean cold start)
- Custom STM32F407 (DMA UART @ 921,600 baud): 4.3 ms total idle pause (~1.2 ms clean cold start)
The optimized STM32F407 core reduces the pure computational cold start down to just 1.2 ms, chipping away half a millisecond from the total loop. More importantly, it offers huge CPU and memory headroom.
Future Outlook:
The final goal is to offload the 3rd order S-curve smoothing entirely to the internal FIR filters of the Minas A6 drives, and route the drive's hardware Position Complete digital output back to the Smoothie endstop pin to handle instantaneous hardware-level settling control on M400.
The firmware is currently undergoing stability testing. If the community is interested, I will share the source code and configuration files once the tests are completed.
вторник, 18 августа 2026 г. в 11:53:08 UTC+3, ORIS ORIS: