T3P3 Kossel Mini Kit Release 3
Appendix D - Firmware Configuration Files
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
RepRap Firmware is configured at run-time by means of files in the /sys folder of the SD card. This means that you must have an SD card in the on-board socket to use RepRap Firmware. You do not have to recompile RepRap Firmware to configure it, so if you wish to update the firmware on your Duet or other compatible electronics board, you can download a ready-built binary.
A few of the commands listed here are specific to the dc42 fork of RepRap Firmware and are not supported by the official RepRapPro version, although they may be supported in other forks e.g. the forks of Christian Hammacher, Dan Newman, and Think3DPrint3D. To see what the commands do and which firmware fork(s) implement them, see G-code.
This page describes how to set up the configuration files for Cartesian printers, and forms the basis for setting up all printer types. However, the same firmware binary also supports Delta, CoreXY and CoreXZ printers. For the changes you need to make for other types of printer, see Configuring and calibrating a delta printer using the dc42 fork of RepRapFirmware
Main configuration file
The main configuration file is sys/config.g. This file is read when RepRap Firmware starts up. It is typically organised into sections along the following lines. (using the Mini Kossel config.g file as an example)
; Configuration file for Mini Kossel kit from Think3DPrint3D
Prologue and communications section
; Communication and general
M111 S0 ; Debug off
M550 PMiniKossel ; Machine name and Netbios name (can be anything you like)
M551 Preprap ; Machine password (used for FTP)
M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED ; MAC Address
;*** Adjust the IP address and gateway in the following 2 lines to suit your network
M552 P192.168.1.14 ; IP address (0:0:0:0 = use DHCP)
M554 P192.168.1.1 ; Gateway
M553 P255.255.255.0 ; Netmask
M555 P2 ; Set output to look like Marlin
G21 ; Work in millimetres
G90 ; Send absolute coordinates...
M83 ; ...but relative extruder moves
The machine name is used as a basis for the netbios name, so in the above example if your router supports netbios then you can attach to the web interface by typing "MiniKossel/" into your browser. The password is used when connecting via FTP. If you have more than one Duet on your network, you must given them all different MAC addresses.
; Axis and motor configuration
M569 P0 S1 ; Drive 0 goes forwards (change to S0 to reverse it)
M569 P1 S1 ; Drive 1 goes forwards
M569 P2 S1 ; Drive 2 goes forwards
M569 P3 S1 ; Drive 3 goes forwards
M569 P4 S1 ; Drive 4 goes forwards
The M569 commands are optional; drives go forward by default.
The XYZ parameters to the M574 command are 0 if there is no homing switch for the axis, 1 if there is a low-end homing switch, and 2 if there is a high-end homing switch. S1 indicates active high inputs (e.g. normally-closed switches), while S2 indicates active low inputs. For a delta printer you need to tell RepRap Firmware that the endstop switches are all at the high end:-
M574 X2 Y2 Z2 S1 ; set endstop configuration (all endstops at high end, active high)
To tell RepRap Firmware that your printer is a delta and to define its parameters, put command M665 L### R### H### B### X### Y### Z### in your sys/config.g file on the SD card, where ### represents a number. The L parameter is the diagonal rod length. The R parameter is your estimate of the delta radius. The H parameter is the height of the nozzle above the bed when the carriages are activating the endstop switches. The B parameter is the printable radius of the bed. X Y Z are the angular offsets of the X, Y and Z towers, and may be omitted or set to zero. All these values may include decimal portions.
*** The homed height is deliberately set too high in the following - you will adjust it during calibration
M665 R105.6 L215.0 B85 H250 ; set delta radius, diagonal rod length, printable radius and homed height
M666 X0 Y0 Z0 ; put your endstop adjustments here, or let auto calibration find them
You can also use an M666 command to set the homing switch corrections.
M92 X80 Y80 Z80 ; Set axis steps/mm
The M906 command is required. Without it, motor currents will remain at zero. It also takes an optional I parameter, which is the percentage of normal current used to hold the motors in position when the motors have been idle for 30 seconds, default 30%.
M906 X1000 Y1000 Z1000 E1000 ; Set motor currents (mA)
M201 X1000 Y1000 Z1000 E1000 ; Accelerations (mm/s^2)
M203 X20000 Y20000 Z20000 E3600 ; Maximum speeds (mm/min)
M566 X1200 Y1200 Z1200 E1200 ; Maximum instant speed changes mm/minute
;*** If you have a Duet board stickered "4.7K", or a Duet V0.8.5 change R1000 to R4700 to the following M305 commands
M305 P0 T100000 B3950 R4700 H30 L0 ; Put your own H and/or L values here to set the bed thermistor ADC correction
M305 P1 T100000 B3974 R4700 H30 L0 ; Put your own H and/or L values here to set the first nozzle thermistor ADC correction
M305 P2 T100000 B3974 R1000 H30 L0 ; Put your own H and/or L values here to set the second nozzle thermistor ADC correction
M570 S180 ; Hot end may be a little slow to heat up so allow it 180 seconds
The M305 commands define the thermistor resistance at 25C (T parameter), thermistor B value (B parameter), thermistor series resistance (R value), and ADC high and low end corrections (H and L parameters).
You can get the thermistor resistance and B value from the thermistor datasheet. Note that the B value is typically given on the datasheet over quite a low temperature range, for example 25C to 85C. If the manufacturer publishes a resistance vs. temperature chart, it is better to use it to calculate the B value from 25C to the average extrusion temperature you use, for example 220C. The Semitec 104GT-2 thermistor supplied with the E3Dv6 hot end has a quoted B value of 4267, but the actual value over 25C to 220C is 4388.
The R value depends on which version of the Duet you have. Older Duet 0.6 boards, and Duet 0.6 boards supplied by Replikeo according to recent reports, use 1K series resistors, which is the firmware default. Later Duet 0.6 boards and all Duet 0.8.5 boards and Duet Shields use 4.7K resistors. If the hot end and bed temperatures read about 60C when they are at room temperature, this generally means that you have configured the firmware for 1K series resistor but your board uses 4.7K.
The H and L values allow you to compensate for ADC offsets at the high and low ends of the ADC input voltage range. The H parameter adjusts the high end offset, which affects the reading at low temperatures; whereas L adjusts the low end offset which affects readings at high temperatures. At room temperature, if your temperature readings are lower than actual, use a positive H parameter to bring the readings up to the correct value. If the readings are too high, use a negative H parameter. You should not need to use an H parameter outside the range -100 to +100, and in theory all channels should need the same H value.
The M305 command also takes an optional X parameter (not shown in the example) to allow thermistor channel remapping. For example, if in the M305 P0 command you add parameter X3, this means use the thermistor channel normally associated with heater 3 to read the temperature of heater 0 (i.e. the bed). Future versions of RepRapFirmware may use thermistor channel numbers 100 upwards to denote readings from thermocouples.
The M301 commands set the PID parameters for each heater channel. P, I and D are the usual PID parameters. A negative P value means use bang-bang control for that channel (which is the default for the bed). W is the maximum value of the I accumulator (0 to 255). B is the temperature band within which PID is used, for example if B is 30 then the heater will be full on or off until it is within 30C of the set temperature. T is the approximate additional PWM value (on a scale of 0 to 255) needed per 1C of additional temperature, used to pre-set the I accumulator when switching to PID. Finally, the PID output can be scaled by the S term. This allows you to adapt to a different heater power or supply voltage without having to change all of P, I, D and T.
The M570 command defines the time-to-hot timeout in seconds. When heating up the hot end, if the heater temperature is not within 2.5C of the commanded temperature within this time then the heater will be turned off and an error condition reported.
If you have a chamber heater, use the M141 command to define which heater channel it uses. You will also need to use M305 and M301 to define thermistor and PID parameters for that channel.
; Tool definitions
M563 P0 D0 H1 ; Define tool 0
G10 P0 S0 R0 ; Set tool 0 operating and standby temperatures
;*** If you have a dual-nozzle build, un-comment the next 2 lines
;M563 P1 D1 H2 ; Define tool 1
;G10 P1 S0 R0 ; Set tool 1 operating and standby temperatures
M92 E663:663 ; Set extruder steps per mm
; Z probe and compensation definition
;*** If you have an IR zprobe instead of a switch, change P4 to P1 in the following M558 command
M558 P1 X0 Y0 Z0 ; Z probe is an IR probe switch and is not used for homing any axes
G31 X0 Y0 Z1.80 P500 ; Set the zprobe height and threshold (put your own values here)
;*** If you are using axis compensation, put the figures in the following command
M556 S78 X0 Y0 Z0 ; Axis compensation here
M208 S1 Z0.0 ; set minimum Z
T0 ; select first hot end