#Flush_handler error on a toolchange

24 messages · Page 1 of 1 (latest)

halcyon bloom
#

On a toolchange with the ERCF running HH I get 'flush_handler' errors with the printer shutting down.

Internal error on command:"MMU_CHANGE_TOOL"
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/gcode.py", line 211, in _process_commands
    handler(gcmd)
  File "/home/pi/klipper/klippy/gcode.py", line 137, in <lambda>
    func = lambda params: origfunc(self._get_extended_params(params))
  File "/home/pi/klipper/klippy/extras/mmu.py", line 5417, in cmd_MMU_CHANGE_TOOL
    if self._change_tool(tool, skip_tip, next_pos):
  File "/home/pi/klipper/klippy/extras/mmu.py", line 5187, in _change_tool
    self._unload_tool(skip_tip=skip_tip)
  File "/home/pi/klipper/klippy/extras/mmu.py", line 5141, in _unload_tool
    self._unload_sequence(skip_tip=skip_tip, runout=runout)
  File "/home/pi/klipper/klippy/extras/mmu.py", line 4210, in _unload_sequence
    self._initialize_filament_position(dwell=None)    # Encoder 0000
  File "/home/pi/klipper/klippy/extras/mmu.py", line 3141, in _initialize_filament_position
    self._set_filament_position()
  File "/home/pi/klipper/klippy/extras/mmu.py", line 3149, in _set_filament_position
    self.mmu_toolhead.set_position(pos)
  File "/home/pi/klipper/klippy/extras/mmu_toolhead.py", line 165, in set_position
    super(MmuToolHead, self).set_position(newpos, homing_axes)
  File "/home/pi/klipper/klippy/toolhead.py", line 456, in set_position
    self.flush_step_generation()
  File "/home/pi/klipper/klippy/toolhead.py", line 371, in flush_step_generation
    self._advance_flush_time(self.step_gen_time)
  File "/home/pi/klipper/klippy/toolhead.py", line 310, in _advance_flush_time
    m.flush_moves(flush_time, clear_history_time)
  File "/home/pi/klipper/klippy/mcu.py", line 954, in flush_moves
    raise error("Internal error in MCU '%s' stepcompress"
mcu.error: Internal error in MCU 'sb2040' stepcompress
halcyon bloom
#

This is a bit further back in the file

b'stepcompress o=6 i=0 c=720 a=0: Invalid sequence'
Exception in flush_handler
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/toolhead.py", line 447, in _flush_handler
    self._advance_flush_time(min(end_flush, ftime))
  File "/home/pi/klipper/klippy/toolhead.py", line 310, in _advance_flush_time
    m.flush_moves(flush_time, clear_history_time)
  File "/home/pi/klipper/klippy/mcu.py", line 954, in flush_moves
    raise error("Internal error in MCU '%s' stepcompress"
mcu.error: Internal error in MCU 'sb2040' stepcompress
Transition to shutdown state: Exception in flush_handler
halcyon bloom
#

b'stepcompress o=6 i=0 c=720 a=0: Invalid sequence'
This means that the steps have a 'oid' of 6 (whatever that means), an 'interval' and 'add' of 0, and a 'count' of 720

https://github.com/Klipper3d/klipper/blob/master/klippy/chelper/stepcompress.c#L206

static int
check_line(struct stepcompress *sc, struct step_move move)
{
    if (!CHECK_LINES)
        return 0;
    if (!move.count || (!move.interval && !move.add && move.count > 1)
        || move.interval >= 0x80000000) {
        errorf("stepcompress o=%d i=%d c=%d a=%d: Invalid sequence"
               , sc->oid, move.interval, move.count, move.add);
        return ERROR_RET;
    }
    .
    .
    .
    .
}
#

This function states that interval and add can't be 0 if count is more than 1

I just don't know where these values come from and why it's causing an error. My knowledge only goes this far...

worldly reef
#

I am also getting this issue

#

@halcyon bloom did you manage to sort this?

halcyon bloom
worldly reef
#

Do you know the lines of those 2 commands?

#

I have this disabled
retry_tool_change_on_error: 0

halcyon bloom
#
retry_tool_change_on_error: 1    # Whether to automatically retry a failed tool change. If enabled Happy Hare will perform
                # the equivalent of 'MMU_RECOVER' + 'Tx' commands which usually is all that is necessary
                # to recover. Note that enabling this can mask problems with your MMU
print_start_detection: 1    # ADVANCED: Enabled for Happy Hare to automatically detect start and end of print and call
                # _MMU_START_PRINT and _MMU_END_PRINT. Disable if you want to include in your own macros
show_error_dialog: 1        # 1 = show pop-up dialog in addition to console message, 0 = show error in console
encoder_move_validation: 1    # 1 = Normally Encoder validates move distances are within given tolerance (slower but more safe)
                # 0 = Validation is disabled for many moves (eliminates slight pause between moves but less safe)

This is from line 357

halcyon bloom
worldly reef
#

I just do a toolchange and then the printer shuts down

halcyon bloom
#

Can you share your [stepper_mmu_gear] and [extruder] sections?

worldly reef
#
uart_pin: mmu:MMU_GEAR_UART
run_current: 1.0            # ERCF BOM NEMA14 motor
hold_current: 0.1            # Recommend to be small if not using "touch" or move (TMC stallguard)
interpolate: True
sense_resistor: 0.110            # Usually 0.11, 0.15 for BTT TMC2226
stealthchop_threshold: 0        # Spreadcycle has more torque and better at speed
#
# Uncomment two lines below if you have TMC and want the ability to use filament "touch" homing with gear stepper
#diag_pin: ^mmu:MMU_GEAR_DIAG        # Set to MCU pin connected to TMC DIAG pin for gear stepper
#driver_SGTHRS: 60            # 255 is most sensitive value, 0 is least sensitive

[stepper_mmu_gear]
step_pin: mmu:MMU_GEAR_STEP
dir_pin: mmu:MMU_GEAR_DIR
enable_pin: !mmu:MMU_GEAR_ENABLE
rotation_distance: 22.7316868        # Bondtech 5mm Drive Gears. Will be overriden by `mmu_gear_rotation_distance` in mmu_vars.cfg
gear_ratio: 80:20            # ERCF 80:20, Tradrack 50:17
microsteps: 16                 # Recommend 16
full_steps_per_rotation: 200        # 200 for 1.8 degree, 400 for 0.9 degree
#
# Uncomment the two lines below to enable filament "touch" homing option with gear motor
#extra_endstop_pins: tmc2209_stepper_mmu_gear:virtual_endstop
#extra_endstop_names: mmu_gear_touch```
#
step_pin: shtcan:PB4 #
dir_pin: shtcan:PB3 #
enable_pin: !shtcan:PA15 #
##    rotation_distance = <previous_rotation_distance> * <actual_extrude_distance> / 100 #
rotation_distance: 28.01772 # 
gear_ratio: 50:8 #
microsteps: 16 #
full_steps_per_rotation: 200    #200 for 1.8 degree, 400 for 0.9 degree #
nozzle_diameter: 0.400
filament_diameter: 1.75
heater_pin: shtcan:PA8
sensor_pin: shtcan:PA3
sensor_type: ATC Semitec 104NT-4-R025H42G
#pullup_resistor: 2200
control: pid
pressure_advance: 0.05 #
pressure_advance_smooth_time: 0.020 #
pid_Kp: 22.274
pid_Ki: 1.768
pid_Kd: 70.163
min_temp: -100
max_temp: 325
max_extrude_only_distance: 200
max_extrude_cross_section: 50.0

[tmc2209 extruder]
uart_pin: shtcan:PB5
run_current: 0.4
stealthchop_threshold: 0
interpolate: true```
halcyon bloom
#

Try setting microsteps: 8 in the extruder section, and leave the gear at 16. If that doesn't work, swap them around.

worldly reef
#

same issue wioth both of those ways

halcyon bloom
#

Sorry, Then I'm out of options 😦

worldly reef
#

Ok, this error is specific to HHv2 and DangerKlipper. if you get it:

#

add this to line 30 of mmu_toolhead.py (in /home/pi/Happy-Hare/extras)
self.danger_options = self.printer.lookup_object("danger_options")
reboot, should be golden

halcyon bloom
#

What does that do?

worldly reef
#

No idea

#

😉