Configuring RepRapFirmware for a CNC machine
To configure RepRapFirmware for a CNC machine, follow the instructions for configuring RepRapFirmware for a 3D printer using the same architecture (e.g. Cartesian), ignoring anything to do with extruders. You still need to define at least one tool using M563, but it can have zero associated heaters and zero extruder drives.
To put the firmware in CNC mode and tell it which outputs to use for spindle motor control, use the M453 command, see Gcode.
If you are going to use work offsets, by ending the config.g file with a G54 command, those will be used by default. To modify the offsets use G10 L2 P1 or G10 L20 P1 commands.
The pause.g file should be changed to ensure that the spindle does not come into contact with the work piece by lifting to the maximum Z travel.
Below is an example of a pause script.
G1 Z195 F360 ; Lift Z to 5mm below the Z maximum M5 ; Turn off the spindle G4 S10 ; Wait for the spindle to stop G1 X0 Y0 F6000 ; Go to X=0 Y=0
The resume script should also be modified.
M3 R1 ; Restore the spindle speed from before the pause G4 S10 ; Wait for the spindle the get up to speed G1 R1 X0 Y0 Z5 F6000 ; Go to 5mm above position of the last cut move G1 R1 X0 Y0 ; Go back to the last cut move
When a job is paused the coordinates and spindle RPM are saved to slot 1 automatically
Be sure that the stop.g file exists. Otherwise pausing a job will also disable the stepper drivers and the machine would need to be homed again.
Using specialised Gcodes
Many CNC machines and CNC gcode generators use specialised, or non-standard Gcodes to perform certain functions. A list of currently supported Gcodes is HERE, and a list of Gcodes NOT supported is HERE.
In RepRapFirmware 2.03 and later, if you try to execute a G- or M-command that RRF does not implement, it will execute a system macro of that name if it exists. For example, if you send G40 then it will execute /sys/G40.g if it exists; and if you send M48 then it will execute /sys/M48.g if it exists. So you can script any custom Gcodes that you need. See https://forum.duet3d.com/topic/14930/m7-... for an example.
Movement in Inches
If your CNC machine and Gcode work in inches then see the documentation for [G20].
See this forum thread for a more detailed discussion.
Connecting a CNC pendant
Here CNC Pendant are instructions on converting a readily-available CNC pendant to use with a Duet.