Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
9.46k stars 5.31k forks source link

Trying to configure a CoreXY, Dual Z, TMC2130 on MKS Gen 1.4 #1117

Closed Lyr3x closed 5 years ago

Lyr3x commented 5 years ago

I have some problems to port my Marlin Configuration to a working Klipper config. My Setup is as follows:

[tmc2130 stepper_x] cs_pin: ar59 microsteps: 16 run_current: 0.950 hold_current: 0.500 stealthchop_threshold: 100 driver_SGT: 3 diag1_pin: ^!ar3 sense_resistor: 0.11

[stepper_y] step_pin: ar60 dir_pin: !ar61 enable_pin: !ar56 step_distance: .0125 endstop_pin: tmc2130_stepper_y:virtual_endstop

endstop_pin: ^ar15

position_endstop: 0 position_max: 300 homing_speed: 50

[tmc2130 stepper_y] cs_pin: ar63 microsteps: 32 run_current: 0.950 hold_current: 0.500 stealthchop_threshold: 200 driver_SGT: 5 diag1_pin: ^!ar14 sense_resistor: 0.11

[stepper_z] step_pin: ar46 dir_pin: ar48 enable_pin: !ar62 step_distance: .0025 endstop_pin: probe:z_virtual_endstop

endstop_pin: ^ar19

position_max: 270 position_min: -2

[tmc2130 stepper_z] cs_pin: ar40 microsteps: 16 run_current: .800 sense_resistor: 0.11

[stepper_z1] step_pin: ar36 dir_pin: ar34 enable_pin: ar30 step_distance: .0025 endstop_pin: ^ar19

[tmc2130 stepper_z1] cs_pin: ar44 microsteps: 16 run_current: .8 sense_resistor: 0.11

[printer] kinematics: corexy max_velocity: 300 max_accel: 3000 max_z_velocity: 5 max_z_accel: 100

jakep82 commented 5 years ago

You need to define your endstop pin for stepper_z (^ar19), and comment it out for stepper_z1. You aren't using a probe, so you don't have a virtual endstop. Both Z motors will stop when that pin is triggered.

For the XY steppers, just change the dir_pin on one of them if it's running the wrong direction. Adding or removing a ! will change the direction.

Lyr3x commented 5 years ago

I just let the probe section out here. I configured a bltouch. Damn didn't saw the endstop line. Will check tomorrow again

Here is the complete configuration file:

# This file contains common pin mappings for RAMPS (v1.3 and later)
# boards. RAMPS boards typically use a firmware compiled for the AVR
# atmega2560 (though other AVR chips are also possible).

# See the example.cfg file for a description of available parameters.

[stepper_x]
step_pin: ar54
dir_pin: ar55
enable_pin: !ar38
step_distance: .0125
endstop_pin: tmc2130_stepper_x:virtual_endstop
#endstop_pin: ^ar2
position_endstop: 0
position_max: 300
homing_speed: 50

[tmc2130 stepper_x]
cs_pin: ar59
microsteps: 16
run_current: 0.950
hold_current: 0.500
stealthchop_threshold: 100
driver_SGT: 3
diag1_pin: ^!ar3
sense_resistor: 0.11

[stepper_y]
step_pin: ar60
dir_pin: !ar61
enable_pin: !ar56
step_distance: .0125
endstop_pin: tmc2130_stepper_y:virtual_endstop
#endstop_pin: ^ar15
position_endstop: 0
position_max: 300
homing_speed: 50

[tmc2130 stepper_y]
cs_pin: ar63
microsteps: 32
run_current: 0.950
hold_current: 0.500
stealthchop_threshold: 200
driver_SGT: 5
diag1_pin: ^!ar14
sense_resistor: 0.11

[stepper_z]
step_pin: ar46
dir_pin: ar48
enable_pin: !ar62
step_distance: .0025
endstop_pin: probe:z_virtual_endstop
#endstop_pin: ^ar19
position_max: 270
position_min: -2

[tmc2130 stepper_z]
cs_pin: ar40
microsteps: 16
run_current: .800
sense_resistor: 0.11

[stepper_z1]
step_pin: ar36
dir_pin: ar34
enable_pin: ar30
step_distance: .0025
endstop_pin: ^ar19

[tmc2130 stepper_z1]
cs_pin: ar44
microsteps: 16
run_current: .8
sense_resistor: 0.11

[probe]
pin: ar32
#   Probe detection pin. This parameter must be provided.
x_offset: 23
#   The distance (in mm) between the probe and the nozzle along the
#   x-axis. The default is 0.
y_offset: 0.0
#   The distance (in mm) between the probe and the nozzle along the
#   y-axis. The default is 0.
z_offset: 0.00
#   The distance (in mm) between the bed and the nozzle when the probe
#   triggers. This parameter must be provided.
speed: 5.0
#   Speed (in mm/s) of the Z axis when probing. The default is 5mm/s.
activate_gcode:
    SET_SERVO SERVO=bltouch ANGLE=10
    SET_SERVO SERVO=bltouch ANGLE=60
    G4 P1000
#   A list of G-Code commands (one per line; subsequent lines
#   indented) to execute prior to each probe attempt. This may be
#   useful if the probe needs to be activated in some way. Do not
#   issue any commands here that move the toolhead (eg, G1). The
#   default is to not run any special G-Code commands on activation.
deactivate_gcode:
    SET_SERVO SERVO=bltouch ANGLE=90
    G4 P100
#   A list of G-Code commands (one per line; subsequent lines
#   indented) to execute after each probe attempt completes. Do not
#   issue any commands here that move the toolhead. The default is to
#   not run any special G-Code commands on deactivation.
[servo bltouch]
pin:ar11
#ar11
maximum_servo_angle: 180
minimum_pulse_width: 0.0006
maximum_pulse_width: 0.0024

#[bltouch]
#sensor_pin: ar32
# Pin connected to the BLTouch sensor pin. This parameter must be

# provided.

#control_pin: ar7

# Pin connected to the BLTouch control pin. This parameter must be

# provided.

[homing_override]
set_position_z: 0
axes: z
gcode:
    ; G90   ; Uncomment these 2 lines to blindly lift the Z 2mm at start
    ; G1 Z2 F600
    G28 X0 Y0
    G1 X150 Y150 F3600
    G28 Z5

# Example bed_mesh config section
[bed_mesh]
min_point: 20,20
max_point: 200,200
probe_count: 4,4

[thermistor marlin_no13]
# 100k Hisens 3950
temperature1:21
resistance1:109000
temperature2:50
resistance2:33300
temperature3:111
resistance3:4300

[extruder]
step_pin: ar26
dir_pin: ar28
enable_pin: !ar24
step_distance: .002228
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: ar10
sensor_type: marlin_no13
sensor_pin: analog13
control: pid
pid_Kp: 13.76
pid_Ki: 0.73
pid_Kd: 64.84
min_temp: 0
max_temp: 250

[tmc2130 extruder]
cs_pin: ar42
microsteps: 16
run_current: .8
sense_resistor: 0.11

#[extruder1]
#step_pin: ar36
#dir_pin: ar34
#enable_pin: !ar30
#heater_pin: ar9
#sensor_pin: analog15
#...

[heater_bed]
heater_pin: ar8
sensor_type: NTC 100K beta 3950
sensor_pin: analog14
control: watermark
min_temp: 0
max_temp: 130

[fan]
pin: ar9

[mcu]
serial: /dev/ttyUSB0
pin_map: arduino

[printer]
kinematics: corexy
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

# "RepRapDiscount 2004 Smart Controller" type displays
#[display]
#lcd_type: hd44780
#rs_pin: ar16
#e_pin: ar17
#d4_pin: ar23
#d5_pin: ar25
#d6_pin: ar27
#d7_pin: ar29
#encoder_pins: ^ar31, ^ar33
#click_pin: ^!ar35

# "RepRapDiscount 128x64 Full Graphic Smart Controller" type displays
#[display]
#lcd_type: st7920
#cs_pin: ar16
#sclk_pin: ar23
#sid_pin: ar17
#encoder_pins: ^ar31, ^ar33
#click_pin: ^!ar35
#kill_pin: ^!ar41

# 128x64 Full Graphic Creality CR10 / ENDER 3 stockdisplay
#[display]
#lcd_type: st7920
#cs_pin: ar27
#sclk_pin: ar25
#sid_pin: ar29
#encoder_pins: ^ar23, ^ar17
#click_pin: ^!ar35
jakep82 commented 5 years ago

So are you using an endstop switch, or are you using the probe as an endstop? The way you have it set up, you're using the bltouch as an endstop for stepper_z, and a separate endstop switch for stepper_z1. That's not a proper configuration. Also, have you run query_endstops?

I would suggest running through this document if it's a new printer to confirm everything is configured correctly.

Lyr3x commented 5 years ago

The Z1 endstop is a misconfiguration. I'll check the document 👍

jakep82 commented 5 years ago

If you remove the endstop pin from stepper_z1, that will likely fix your issue with only 1 Z stepper running. If you're using a genuine bltouch, I would also recommend removing the probe and servo sections, and uncommenting the bltouch section.

Lyr3x commented 5 years ago

Alright i changed the direction of the x axis but this did not solve the issue regarding the corexy kinematics. Testing with STEPPER_BUZZ STEPPER=stepper_x: results now in an diagonal move from mid to 0/0 STEPPER_BUZZ STEPPER=stepper_y: only the B motor turns

changed z stepper to:

[stepper_z]
step_pin: ar46
dir_pin: ar48
enable_pin: !ar62
step_distance: .0025
endstop_pin: probe:z_virtual_endstop
#endstop_pin: ^ar19
position_max: 270
position_min: -2

[tmc2130 stepper_z]
cs_pin: ar40
microsteps: 16
run_current: .800
sense_resistor: 0.11

[stepper_z1]
step_pin: ar36
dir_pin: ar34
enable_pin: ar30
step_distance: .0025

[tmc2130 stepper_z1]
cs_pin: ar44
microsteps: 16
run_current: .8
sense_resistor: 0.11

But still no double z movement

jakep82 commented 5 years ago

That is correct regarding stepper_buzz. Kinematics are not loaded, so it only moves the stepper you've defined as X or Y. A diagonal move is expected. Have you tried running G28 X0 to see if it moves correctly?

Regarding stepper_z1, I think you need !ar30 for your enable pin.

Lyr3x commented 5 years ago

Regarding X/Y we are getting closer: X/Y moving both in the right direction but in addition a litte diagonal.

jakep82 commented 5 years ago

You've configured stepper_x with 16 microsteps, and stepper_y with 32. They should both be the same

jakep82 commented 5 years ago

I would also strongly recommend using the same stealthchop threshold for X and Y.

Lyr3x commented 5 years ago

Damn, i am blind.. Sorry dude 👎 Already changed the stealthchop values. X/Y moving fine now but the second z motor doesnt do anything

jakep82 commented 5 years ago

Did you change the enable pin on stepper_z1? Are you sure all the pins for both Z steppers are correct? Which one doesn't move?

Lyr3x commented 5 years ago

So here are the updated config part:

[stepper_z]
step_pin: ar46
dir_pin: ar48
enable_pin: !ar62
step_distance: .0025
endstop_pin: probe:z_virtual_endstop
#endstop_pin: ^ar19
position_max: 270
position_min: -2

[tmc2130 stepper_z]
cs_pin: ar40
microsteps: 16
run_current: .800
sense_resistor: 0.11

[stepper_z1]
step_pin: ar36
dir_pin: ar34
enable_pin: !ar30
step_distance: .0025

[tmc2130 stepper_z1]
cs_pin: ar44
microsteps: 16
run_current: .800
sense_resistor: 0.11

RAMPS.h:

#define Z_STEP_PIN         46
#define Z_DIR_PIN          48
#define Z_ENABLE_PIN       62
#ifndef Z_CS_PIN
  #define Z_CS_PIN         40
#endif

#define E1_STEP_PIN        36
#define E1_DIR_PIN         34
#define E1_ENABLE_PIN      30
#ifndef E1_CS_PIN
  #define E1_CS_PIN        44
#endif

Z is the working stepper.

jakep82 commented 5 years ago

Are you using a jumper wire for the CS pin? Are you sure it's connected to ar44? You could also try switching motor connections on the board to verify that the motor works.

Lyr3x commented 5 years ago

Weird, i reflashed the MCU part and now the Z Motors are working. Not sure what was wrong there.

I just need to get the BLTouch working and im good to go. Servo is working fine but the endstop is not yet Edit: fixed. Pin Number was wrong.

Thank you for your help!

jakep82 commented 5 years ago

If it's a clone, good luck. You'll find a lengthy issue here regarding clones, and some are not working well. If it's genuine, I would delete the probe and servo sections in your config, and only use the bltouch section. It's easier to configure and works well with a genuine bltouch

Lyr3x commented 5 years ago

Okay i'll change that because its a genuine. Thank you!