Sensorless Homing: Subsequent Homing Attempts

Basic Information:

Printer Model: custom cartesian
MCU / Printerboard: BTT Pico
Host / SBC: BTT Pi
klippy-cartesian.log (4.9 MB)

I am going through the process of trying to set up sensorless homing on a cartesian printer (only testing the y-axis for now). The first y-axis homing command succeeds and acts as expected, but subsequent homing attempts act as if a flag in the driver hasn’t cleared (homing immediately triggers regardless of where the carriage is).

I’ve tried a few speeds (between 5-50 mm/s) and sensitivities ( between 10-250) and the issue persists. Also tried a few homing retract distances with no effect. Really doesn’t seem like it has anything to do with the normal tuning process.

I read that the TMC2209 might have a sensorless homing flag-clearing issue of some sort/ it needs time to do so, but I found that waiting any amount of time (and even disabling the steppers) apparently does nothing to fix the issue. The only thing that seems to fix the issue is restarting the printer.

Requested a driver debug report with the “DUMP_TMC STEPPER=stepper_y” command.

Edit: Output is shown in the klippy log. Removed the code shown here because I work 16 hour days and I was tired of coming home and seeing some new pedantic comment about code formatting clogging up the discussion. Proof that no matter what you do to make someone else’s life easier, they will always complain.

As far as I can tell, none of these debug parameters indicate much about a flag not clearing, but I could be wrong. At a loss of what to try next.

Hi @TpForMyBungholio ,

Please properly format code blocks (your console output):

code_tags

2 Likes

Looks even worse formatted, but alright.

When you do it with every line: Of course.
It meant to be used for the whole block.
And please omit empty lines within.

It should look like this:

### **Y-Axis driver debug report prior to issuing first home command (which then homes fine):**
SG_RESULT:  000000d6 sg_result=214
PWM_AUTO:   00250032 pwm_ofs_auto=50 pwm_grad_auto=37
PWM_SCALE:  0000002d pwm_scale_sum=45
PWMCONF:    c80d0e24 pwm_ofs=36 pwm_grad=14 pwm_freq=1 pwm_autoscale=1 pwm_autograd=1 pwm_reg=8 pwm_lim=12
DRV_STATUS: c01c0000 cs_actual=28 stealth=1 stst=1
CHOPCONF:   34030053 toff=3 hstrt=5 tbl=2 vsense=1 mres=4(16usteps) intpol=1 dedge=1
MSCURACT:   00a60149 cur_a=-183 cur_b=166
MSCNT:      00000378 mscnt=888
TSTEP:      000fffff tstep=1048575
FACTORY_CONF: 0000000e fclktrim=14
IOIN:       210000c9 enn=1 ms2=1 pdn_uart=1 step=1 version=0x21
OTP_READ:   0000000e otp_fclktrim=14
IFCNT:      0000001b ifcnt=27
GSTAT:      00000000
GCONF:      000001c0 pdn_disable=1 mstep_reg_select=1 multistep_filt=1
========== Queried registers ==========
SGTHRS:     0000007d sgthrs=125
TPOWERDOWN: 00000014 tpowerdown=20
COOLCONF:   00000000
TCOOLTHRS:  00000000
TPWMTHRS:   00000000
IHOLD_IRUN: 00081c1c ihold=28 irun=28 iholddelay=8
SLAVECONF:  00000200 senddelay=2
========== Write-only registers ==========
### **Y-axis driver debug report after secondary home command (immediately triggers/ does not work properly):**
**The only lines that differ from above are the following:**
DRV_STATUS: c01c0080 olb=1(OpenLoad_B!) cs_actual=28 stealth=1 stst=1
IOIN:       210000c8 ms2=1 pdn_uart=1 step=1 version=0x21         NOTE: enn=1 not specified
IFCNT:      0000002b ifcnt=43
========== Queried registers ==========
2 Likes

Thank you for burying any useful discussion about the topic with a pedantic flame-war about formatting.

Could you describe how you’ve wired your Pico in regards to the Y-Endstop?

I took a look at your klippy.log and the only thing that jumps out at me is you enabling the STM32’s internal pull-up on the DIAG pin.

[tmc2209 stepper_y]
uart_pin = gpio9
tx_pin = gpio8
uart_address = 2
run_current = 0.875
stealthchop_threshold = 999999
diag_pin = ^gpio3
driver_sgthrs = 125

Looking at the schematics, this is unnecessary because the “Y-STOP” signal going to the MCU runs through a buffer. I doubt this is your problem but, at the very least, this isn’t helpful.

Please explain/draw out how you’ve wired the endstop circuitry.


As a personal observation; if you’re working 16 hours a day are you in the right headspace to be setting up a 3D printer when you come home?

Making snide remarks to the people who are helping you (for free) when they simply ask you to format information in a way that makes it easier for them isn’t a strategy that will result in a successful resolution to your issues.

1 Like

No wiring per se; the Pico uses a jumper to enable sensorless homing for a respective axis.

Okay, I just went over your klippy.log again and noticed that you’re running at high current and don’t have a lower current for homing.

Could I suggest that you add the two macros:

[gcode_macro global] ### Global Variables 
variable_xyz_run_current:   0.875
variable_xyz_home_current:  0.3
variable_xyz_home_sgthrs:  70
gcode:


#### Macros to implement sensorless homing
[gcode_macro _HOME_X]
gcode:
    SET_TMC_CURRENT STEPPER=stepper_x CURRENT={printer["gcode_macro global"].xyz_home_current}
    SET_TMC_CURRENT STEPPER=dual_carriage CURRENT={printer["gcode_macro global"].xyz_home_current}
    SET_TMC_FIELD STEPPER=stepper_x FIELD=SGTHRS VALUE={printer["gcode_macro global"].xyz_home_sgthrs}
    SET_TMC_FIELD STEPPER=dual_carriage FIELD=SGTHRS VALUE={printer["gcode_macro global"].xyz_home_sgthrs}
    G4 P500                                          # Wait for StallGuard registers to clear

    G28 X

    SET_TMC_CURRENT STEPPER=stepper_x CURRENT={printer["gcode_macro global"].xyz_run_current}
    SET_TMC_CURRENT STEPPER=dual_carriage CURRENT={printer["gcode_macro global"].xyz_run_current}

    SET_DUAL_CARRIAGE CARRIAGE=1
    
    G91                                              # Move away to centre of build surface

    SET_DUAL_CARRIAGE CARRIAGE=0
    
    G91                                              # Move away to centre of build surface

[gcode_macro _HOME_Y]
gcode:
    SET_TMC_CURRENT STEPPER=stepper_y CURRENT={printer["gcode_macro global"].xyz_home_current}
    SET_TMC_FIELD STEPPER=stepper_y FIELD=SGTHRS VALUE={printer["gcode_macro global"].xyz_home_sgthrs}

    G4 P500                                          # Wait for StallGuard registers to clear

    G28 Y

    SET_TMC_CURRENT STEPPER=stepper_y CURRENT={printer["gcode_macro global"].xyz_run_current}
    
    G91                                              # Move away to centre of build surface

[gcode_macro _HOME_Z]
gcode:
    SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer["gcode_macro global"].xyz_home_current}
    SET_TMC_FIELD STEPPER=stepper_z FIELD=SGTHRS VALUE={printer["gcode_macro global"].xyz_home_sgthrs}

    G4 P500                                          # Wait for StallGuard registers to clear

    G28 Z

    SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer["gcode_macro global"].xyz_run_current}
    
    G91                                              # Move away to centre of build surface

[homing_override]
axes: xyz                                            
gcode:
  {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

  {% if home_all or 'X' in params %}
    _HOME_X
  {% endif %}
   
  {% if home_all or 'Y' in params %}
    _HOME_Y
  {% endif %}
  
  {% if home_all or 'Z' in params %}
    _HOME_Z
  {% endif %}

The first macro sets up some variables so that you can set values that are used globally and you’re not searching through your printer.cfg looking for specific values to change.

The second & third macros loads the variable values into the TMC2209s, as required, and carries out the sensorless homing operation(s).

I don’t know if 0.3A is acceptable in your printer, that’s something you’ll have to experiment with. You’re looking for a current that moves the carriage/gantry but stalls out easily. You’ll have to experiment with it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.