Peripheral and Driver Testing
This page is used to verify whether peripheral modules such as stepper drivers and CAN toolhead boards are working properly. The testing approach is the same as basic I/O testing, using a minimal Klipper configuration to isolate a single piece of hardware.
If you need to test MCU connection, temperature sensors, fan outputs, or input ports, please refer to Hardware Testing Methods first.
Use Klipper Quick Test to select drivers or other interfaces by board and add them to the test list; this page is used to verify wiring, execution order, and result interpretation. For basic preparation, see Hardware Testing Methods; when done, return to the Machine Commissioning Guide.
Driver Testing
Test Purpose
Use the simplest Klipper configuration to verify whether a single TMC driver (UART or SPI mode) can communicate properly with the mainboard, and confirm that the motor can be controlled.
Prerequisites
Please fully shut down the printer and disconnect the power supply before performing the following operations. Do not plug or unplug driver modules or stepper motor cables while powered on.
- The printer is fully powered off.
- For pluggable drivers, confirm the insertion orientation; onboard fixed drivers must not be removed or replaced with a different model—configure according to the actual board model.
- If using a UART mode driver (such as TMC2209), confirm that the UART jumper cap for the corresponding driver port is installed.
- Connect A the stepper motor to the driver port under test, and leave the other driver ports empty for now.
- Back up the original complete configuration file, and prepare a temporary
printer.cfgcontaining only the basic minimal configuration and the driver fragment under test.
Single Driver Minimal Configuration
First write the basic minimal configuration, then append the test fragment corresponding to the current driver mode after the basic configuration. [manual_stepper] still requires a minimal [printer] section (kinematics: none), which is simpler than a motion axis configuration and suitable for pure hardware verification.
Basic Minimal Configuration
Use the basic minimal configuration from Hardware Testing Methods. If you copied a complete configuration from the quick test tool, it already includes [mcu] and [printer]; do not add them again. The examples below on this page are only appended fragments.
Driver Test Configuration Fragment
Below only the driver test fragment to be appended is shown; do not add a second [printer] or [mcu].
- UART mode (TMC2209)
- SPI mode (TMC5160 / TMC2130, etc.)
[manual_stepper Drive0]
# Modify the following three items according to the actual mainboard pins
step_pin: PE2
dir_pin: PC5
enable_pin: !PF11
# No changes are needed for the parameters below
microsteps: 16
rotation_distance: 40
velocity: 500
accel: 10000
position_min: 0
position_max: 1000
[tmc2209 manual_stepper Drive0]
# Modify uart_pin according to the actual mainboard pin
# Modify sense_resistor according to the driver manufacturer's documentation
uart_pin: PC4
interpolate: False
run_current: 0.8
sense_resistor: <driver_sense_resistor>
stealthchop_threshold: 0
[manual_stepper Drive0]
# Modify the following three items according to the actual mainboard pins
step_pin: PE2
dir_pin: PC5
enable_pin: !PF11
# No changes are needed for the parameters below
microsteps: 16
rotation_distance: 40
velocity: 500
accel: 10000
position_min: 0
position_max: 1000
[tmc5160 manual_stepper Drive0]
# Modify cs_pin and spi_bus according to the actual mainboard pins
# Modify sense_resistor according to the driver manufacturer's documentation
cs_pin: PC4
spi_bus: spi1a
run_current: 0.8
sense_resistor: <driver_sense_resistor>
stealthchop_threshold: 0
serial: Replace with the actual serial ID of the mainboard (can be viewed vials /dev/serial/by-id/); keep only one instance in the basic minimal configuration.step_pin/dir_pin/enable_pin: Replace with the mainboard pins corresponding to the driver port under test.uart_pin(UART mode) /cs_pin+spi_bus(SPI mode): Replace with the actual pins and SPI bus number.sense_resistor: Applies to the TMC2209 / TMC5160 in the examples; it must be filled in according to the parameters provided by the driver manufacturer—do not guess based solely on the chip model. Different TMC5160 driver boards may be0.075,0.033,0.022, or other values; the TMC2240 test template uses SPI andrref—do not directly apply the TMC2209 UART example on this page orsense_resistor. If the manufacturer's documentation does not specify, please consult the manufacturer first or use their official configuration examples.- The configuration contains no heaters or fans; it is only used for driver communication verification.
Multi-Driver Testing Method
If you need to verify multiple driver ports on a mainboard one by one, you can refer to the naming approach in the test configuration and write each driver port as an independent Drive0, Drive1, Drive2:
[manual_stepper Drive1]
step_pin: PE3
dir_pin: PF13
enable_pin: !PF14
microsteps: 16
rotation_distance: 40
velocity: 500
accel: 10000
position_min: 0
position_max: 1000
[tmc2209 manual_stepper Drive1]
uart_pin: PF12
interpolate: False
run_current: 0.8
sense_resistor: <driver_sense_resistor>
stealthchop_threshold: 0
During testing, only connect the motor to the driver port currently under test; after confirming one port, power off, then switch to the next port.
Test Steps
-
Save the basic minimal configuration and the current driver test fragment as
printer.cfg. -
Confirm the motor and driver are properly inserted before powering on, then start Klipper.
-
In the Mainsail / Fluidd console, enter the following commands to enable the motor and set the current position to
0:MANUAL_STEPPER STEPPER=Drive0 ENABLE=1MANUAL_STEPPER STEPPER=Drive0 SET_POSITION=0- If the motor has holding torque after enabling,
enable_pinis basically working. - If the motor can still rotate freely, power off and check
enable_pin, driver orientation, jumper caps, and power supply.
- If the motor has holding torque after enabling,
-
Perform the manual movement test:
MANUAL_STEPPER STEPPER=Drive0 MOVE=100 SPEED=100MANUAL_STEPPER STEPPER=Drive0 MOVE=0 SPEED=100MOVE=is the target position, not a relative displacement. After executingMOVE=100, executeMOVE=0and the motor will reverse back to the starting point.- If the motor is still connected to the machine's motion mechanism, it is recommended to first change the value to
MOVE=10 SPEED=5for the first test; after confirming the direction and travel are safe, increase the speed. - If the motor rotates smoothly without stuttering, the driver, motor, and pulse/direction pins are basically normal.
- If the motor does not respond, only vibrates, or moves in the wrong direction, power off and check the pin configuration, motor wire order, driver orientation, and jumper caps.
-
Verify TMC communication status:
DUMP_TMC STEPPER=Drive0If register information is returned normally, UART/SPI communication is basically working; if it reports that registers cannot be read, please refer to TMC Error Troubleshooting.
-
After testing, disable the motor:
MANUAL_STEPPER STEPPER=Drive0 ENABLE=0
Expected Results
| Test Item | Normal Result | Abnormal Behavior |
|---|---|---|
| Manual movement | Motor moves forward and backward according to commands | No movement, vibration, stuttering, or wrong direction |
| TMC communication | DUMP_TMC returns register information | Cannot read UART/SPI registers |
| Holding torque | After ENABLE=1, the motor shaft cannot rotate freely | Shaft rotates easily (not enabled) |
If all three items above are normal, the communication between the driver and mainboard and the motor wiring are fine; you can restore the original printer.cfg and continue troubleshooting other hardware.
CAN Toolhead Board Minimal Test
Test Purpose
Confirm that the CAN toolhead board has been recognized by Klipper, and verify the temperature, fan, accelerometer, or input port on the toolhead board.
Minimal Configuration
First keep the basic minimal configuration, then append the following CAN toolhead board test fragment after the configuration. If you are only testing the CAN toolhead board, please also keep the mainboard [mcu] so that Klipper can start normally and display the mainboard connection status.
[mcu tool]
canbus_uuid: xxxxxxxxxxxx
[temperature_sensor ToolBoard]
sensor_type: temperature_mcu
sensor_mcu: tool
[output_pin tool_FAN0]
pin: tool:gpio13
pwm: True
cycle_time: 0.010
value: 0
shutdown_value: 0
Test Steps
- Follow CAN Network Configuration and ID Search to search for and fill in
canbus_uuid. - After restarting Klipper, check whether the
ToolBoardtemperature displays normally. - Use
SET_PIN PIN=tool_FAN0 VALUE=1to test the toolhead board's low-voltage fan output; after testing, executeSET_PIN PIN=tool_FAN0 VALUE=0. - If you need to test the toolhead board's accelerometer or input port, add the configuration according to the corresponding section above.
CANH/CANL wire order, terminating resistors, jumper caps, and cable management must all be handled with the power off. Do not plug or unplug CAN cables or adjust terminating resistors while powered on.
Common Abnormalities and Next Steps
| Abnormal Behavior | Common klippy.log Keywords | Check First | Next Step |
|---|---|---|---|
| Klipper cannot connect to MCU | Unable to connect, Connect error, Serial connection closed | serial / canbus_uuid, firmware, USB/CAN connection | Common Error Overview |
| Abnormal temperature display | ADC out of range, temperature, not heating | sensor_type, sensor_pin, thermistor connector | Temperature, Heating, and Extrusion Errors |
| Heater or bed shutdown | Verify heater, not heating at expected rate | Thermistor contact, PID, heater power, SSR | Temperature, Heating, and Extrusion Errors |
| Fan not spinning | No error (output ports do not generate logs) | pin, fan voltage specification, PWM compatibility | Swap fan or port for cross-testing |
| Input state unchanged | No error (input ports do not generate logs) | Pull-up ^, wire order, switch type | Check connector and port with power off |
| Accelerometer no data | Invalid adxl345 id, Invalid lis2dw id, timeout | cs_pin, spi_bus, wiring harness, module model | Accelerometer Testing and Calibration |
| Resonance test failure | No data, Insufficient axis data, Frequency range | Sensor mounting, belt tension, fan vibration | Accelerometer Testing and Calibration |
| Motor not moving | Unable to read tmc uart, Unable to write tmc spi | step_pin, dir_pin, enable_pin, TMC configuration | TMC Error Troubleshooting |
| TMC cannot read registers | DRV_STATUS, read register, GSTAT | UART/SPI pins, jumper caps, driver power, driver model | TMC Error Troubleshooting |
| CAN toolhead board offline | bytes_invalid, Network is down, No buffer space, Timer too close | CAN wire order, terminating resistor, power, UUID | CAN Network Configuration and ID Search |
| Random stuttering/loss during printing | Stepper too far in past, Rescheduled timer, Lost communication | Host load, communication cable interference, speed/acceleration | System, Performance, and Service Errors |
| Configuration cannot be saved | Unable to write, Option conflict, CRC does not match | File permissions, auto-save section conflicts, FIRMWARE_RESTART | Configuration Errors |
Reference Configuration Fragments
When maintaining test configurations, you can extract fragments by hardware type from the corresponding mainboard/toolhead board templates:
- Mainboard testing:
temperature_sensor,manual_stepper DriveN,tmcXXXX manual_stepper DriveN,output_pin FANx,gcode_button IOx. - Toolhead board testing:
temperature_sensor,adxl345/lis2dw,manual_stepper Drive0,output_pin FANx,gcode_button. - Multi-driver testing: Keep the naming convention
Drive0,Drive1,Drive2; theSTEPPER=in test commands must match the configuration section names. - Low-voltage output testing: Prefer low-voltage loads such as fans, RGB, and buzzers; do not use heater cartridges or the heated bed as ordinary
output_pintests.
If a module cannot pass the above minimal tests, please restore the original configuration first, then continue troubleshooting on the corresponding FAQ page based on the specific error.
After completing the minimal tests, follow the steps to restore the formal configuration, then perform homing or printing.