The spindle functionality of Smoothie V2 is configured via the Switch module.
V2 Basic Setup
Before using M5, ensure you have:
Enabled spindle control in your configuration
Configured the appropriate output pin (STM32 format: PXn, e.g., PA5)
Set the spindle speed parameters
Note: V2 configuration uses STM32H7xx pin notation (e.g., PA5, PB12) instead of LPC1769 format (e.g., 2.4).
Additional Information
Speed Memory
The last set speed value (from M3) is retained in memory even after M5 is executed. When the spindle is turned on again without an S parameter, it will use this retained speed value.
Queue Synchronization
The M5 command waits for the motion queue to empty before execution. This ensures that all pending movements complete before the spindle stops, maintaining proper timing and coordination.
Emergency Stop Behavior
M5 is automatically issued when M112 (emergency stop) is triggered
When the program ends (M2/M30 in GRBL mode), M5 is automatically issued to safely stop the spindle
Typical G-code Pattern
G21 ; Metric units
G90 ; Absolute positioning
G28 ; Home all axes
M3 S12000 ; Start spindle at 12000 RPM
; ... milling operations ...
M5 ; Stop spindle when done
G28 ; Home all axes
M2 ; End program