Printer Model: Functional Tester
MCU / Printerboard: Custom TMC2209 board
Host / SBC: Raspberry Pi CM4 klippy.log (1.7 MB) NOTE: Klipper is identified as “dirty” because I’m using DynamicMacros, otherwise it’s stock.
I’m just finishing up my functional test - everything is working on a basic level but I wanted to see if I could get non-specific stepper operation (as opposed to having steppers specified to different axes).
I want to use “manual_stepper” as detailed here with a TMC2209 driver:
With the “MANUAL_STEPPER" G-Code Commands:
For the tests, I need the ability to sensorless home (“MANUAL_STEPPER STEPPER=config_name STOP_ON_ENDSTOP=1") and then move to a specific location to return the stepper to position for the next test run (“MANUAL_STEPPER STEPPER=config_name SET_POSITION=<pos>").
I’m trying to define the manual_stepper the same way I’d define a TMC2209 stepper on an axis:
Klipper doesn’t seem to like the “[tmc2209 stepper_1]” statement, no matter how I configure it and it definitely doesn’t like it when I configure it as the virtual endstop.
Am I doing something that can’t be done or is there something wrong with how I’m defining things?
Which discusses manual_stepper- it seems that the [tmc2209 statement in printer.cfg must first and the endstop_pin parameter must have a colon instead of an equals sign.
Doesn’t get the Klipper error but I’m having problems getting the MANUAL_STEPPERG-Code commands working properly. Note that I changed the run_current and velocity parameters to match what I use with sensorless homing on the axis steppers.
The MOVE parameter in a homing move only tells it the maximum it will try to move to the endstop. You’d have to issue another move command after to move it away from the endstop.
That just tells the stepper it’s at position 10. It doesn’t actually move it. If you were to issue a command after with MOVE=0, it would move -10mm.
I would put an ENABLE=1 on the homing move to re enable the stepper.
With no movement and the message: “No trigger on manual_stepper stepper_1 after full movement”
The stepper motor driver is engaged.
Just running:
MANUAL_STEPPER STEPPER=stepper_1 ENABLE=0
and:
MANUAL_STEPPER STEPPER=stepper_1 ENABLE=1
Does disengage/engage the stepper.
Movement commands like:
MANUAL_STEPPER STEPPER=stepper_1 MOVE=15
Work fine.
Now, when I try the homing command, everything seems okay…except for:
One thing for you specifically; when I try to read registers using the Dynamic Macro READ_TMC_FIELD it works fine for the axis drivers but doesn’t recognize the MANUAL_STEPPER driver:
Okay, I think I see what I’m doing wrong here. A few things here:
I have to think about the space the movement takes place. I had it set to -200 to 250 thinking that movements were relative, not to an absolute position. I have to rethink how I’m setting this up as I have less than one turn of the stepper available to me with the test hardware. I’m pretty sure I can get something working correctly here for the test.
I think there’s an issue with not resetting the StallGuard registers before issuing a subsequent move looking to home. In the sequence below, I have done a homing operation and then turned off the stepper by first using the command MANUAL_STEPPER=stepper_1 ENABLE=1 MOVE=10 STOP_ON_ENDSTOP=1and then turn it off using the “Engine Off” icon in the Toolhead Window. Then I do the homing operation again (which there is no movement) and get the response:
I’m not 100% sure that movements to a negative position works correctly. If I do a SETPOSTION=0 then a MOVE=5 and then a MOVE=-5 the stepper is at the SETPOSITION=0 point, not -5. It seems to be moving to positions relative to the last movement, not to what I would think is the absolute position.
I should have put in the test apparatus - it’s a simple striker arm attached to the stepper output shaft that comes into contact on a plate with a post that’s attached to the body of the stepper motor:
The test simply consists of moving the striker arm to the post so that sensorless homing is engaged and then moving the post back the original position to prepare it for the next test.
The verification test that I just ran through the four stepper drivers on two boards is:
Get the initial SG_RESULT register contents using “READ_TMC_FIELD FIELD=sg_result STEPPER=“manual_stepper stepper_#”" command where “#” is the stepper number (from 0 to 3). This produces different results for each of the steppers which leads me to the note below.
Home the stepper arm to the post using “MANUAL_STEPPER STEPPER=stepper_# ENABLE=1 MOVE=10 STOP_ON_ENDSTOP=1" command.
Repeat step 1. which produces a value which is different from the value in step 1. as well as being different for all four stepper drivers.
Move the stepper arm away from the post using the command “MANUAL_STEPPER STEPPER=stepper_# ENABLE=1 MOVE=-5"
Move the stepper arm towards the post using the command “MANUAL_STEPPER STEPPER=stepper_# ENABLE=1 MOVE=5"
Repeat step 1. which produces a value which is different from the value in steps 1. and 4. as well as being different for all four stepper drivers.
Repeat step 2.
Repeat step 1. which produces a value which is different from the value in steps 1., 4. and 6. as well as being different for all four stepper drivers.
So, I think I’m good. The actions of the commands are repeatable across different devices.
Now, two things:
I have to figure out the best position settings for the test apparatus. Just playing around with it now, I believe that a position_max of 40 and a position_minof 0 will give me proper operation, regardless of where the striker arm is when the test starts.
I have to look at the TMC2209 datasheet and figure out a better register to read to determine whether or not the sensorless homing worked correctly.