Failed print due to following error message: Transition to shutdown state: Previous MCU 'mcu' shutdown: Timer too close

Basic Information:

Printer Model: Ender 5+
MCU / Printerboard: Duet 3 Mini 5+
klippy.log

Fill out above information and in all cases attach your klippy.log file. Pasting your printer.cfg is not needed
When pasting code or config snippets use the code tags </> in the menu above

Describe your issue:

Hi all,

I’ve run into an issue today with my ender 5+ shutting down in the middle of a small Caly Dragon print. Error message given is the following: MCU ‘mcu’ is_shutdown: Timer too close in line 16430 followed byt Transition to shutdown state: Previous MCU ‘mcu’ shutdown: Timer too close in line 16635.

This seems to indicate an overload on the raspberry pi, but I can’t see what could be causing this as heated bed and extruder temps seemed stable.

Any idea of what else could be the root cause of this error; could it be my raspberry cam that is pumping a lot if the Pi ressources?

Thanks in advance for your help.

klippy (2).log (2.3 MB)

Hi,

At the low level, the shutdown is caused by a queue_digital_out sent 1.48s past its clock= activation time:

Sent 99 2156.796124 2156.796124 64: seq: 16(64278), 
    tmcuart_send oid=0 write='\xea\x03\xe8\xad\xe1'(6f@0) read=10, 
    tmcuart_send oid=0 write='\xea\x03\xe8\xad\xe1'(6f@0) read=10, 
    tmcuart_send oid=0 write='\xea\x03\xe8\xad\xe1'(6f@0) read=10,
    tmcuart_send oid=0 write='\xea\x03\xe8\xad\xe1'(6f@0) read=10,
    get_clock, 
    queue_digital_out oid=16 clock=773824128(2155.315843) on_ticks=2446875,
    queue_digital_out oid=22 clock=781024128(2155.375843) on_ticks=11611092

Complete shutdown analysis: klippy.shutdown16430.log (65.7 KB)

This shouldn’t happen and you are right to suspect that something is overloading the raspberry pi, such as the webcam. You can try disabling the webcam service, and see if it helps. Additionally you can increase the priority of the klippy process, but I suspect it won’t help much in this case.
The sysload is not exceeding 75%, which is not too bad, unless you have a single core CPU. So it could also be an IO bandwidth issue.
What raspberry pi version and what webcam software are you using?

Also, the series of tmcuart_send that reads DRV_STATUS without getting a response is suggesting that you may have mild communications issues with a tmc driver at uart_address = 0. Possibly extruder_x, as I suspect that the queue_digital_out may be the enabling of its select_pin = PD0.
Klipper sending retries multiple times without throwing an error is expected, if it manage to get a response in the end. But having four duplicates of the same read command is just weird. The bundling could be explained by the pi overload causing transmission delays, I’m not sure.

Good luck.

1 Like

Ok, so, I removed the pi-cam and retry the print, the print got further but ended up producing the same error but this time I can see that I have a temperature warning from the pi as per below:

Previously Temperature Limited

rPi uC (3A+/3B+ only) temperature was at least once above the soft limit (default 60C) since last power-on.

which is weird as I have a fan on the pi, maybe the fan is dead, will have open the printer to check further; in any case if it’s not the pi-cam it may come from the duet screen but I don’t see why as the screen was shutdown as well but not unplugged TBH.

Many thanks for your help Piezo, I’ll keep digging to find out what the root cause may be.

Can you send a new klippy.log? I’m curious to see its again having issues with tmc communication.

sure thing, here you go, sorry had to zip it as it was a little more than 8Mo:
klippy (3).log.zip (1.0 MB)

Well this is quite weird, :exploding_head: I retry the same print and this time it completed without issue.

I checked the fan inside the printer and the pi’s fan is working fine so don’t understand why it “overheated”.

I’m launching a new and longer print, I’ll see how that one goes and report back either way.

Well, after an 1h15 same thing, MCU ‘mcu’ is_shutdown: Timer too close in line 95460, an then Transition to shutdown state: Previous MCU ‘mcu’ shutdown: Timer too close on line 95665. I’m wondering if it’s not the raspberry itself that has an issue.

If that’s the case, then that sucks as they’re quite still difficult to get hands on one unless you wan to pay a crazy high price for it.

klippy (4).log.zip (1.6 MB)

Do you really have the overview about these 2500 lines of printer.cfg?


Some of the shutdown errors is this:

Transition to shutdown state: Shutdown due to required printer.cfg section(s) missing:
Missing CANCEL_PRINT in on_error_gcode for [virtual_sdcard] section.

or this:

Transition to shutdown state: MCU 'mcu' shutdown: Timer too close
This often indicates the host computer is overloaded. Check
for other processes consuming excessive CPU time, high swap
usage, disk errors, overheating, unstable voltage, or
similar system problems on the host computer.

(See here: Timer too close)

Hi Eddy,

I’ve only started seeing the Missing CANCEL_PRINT error after removing the webcam and blocking all related config section in the different concerned files for example in the moonraker.conf file following that I added the CANCEL_PRINT section in [virtual_sdcard], this allowed me to run a print without issues as I mentioned earlier and after that print I ran a longer one and then it failed.

As I only started getting this error after adding the webcam I thought it was the culprit and removed it which allowed me to complete a short print as mentioned earlier but looks like I definetly have something else going on. From what can see in Sineos’s post I can discard the webcam already as it has been removed, don’t thing that is the pi power but will get a new one to try out, there’s nothing else plug into the pi, so based on Sineos post this can only be one of the below:

  • High disk activity of the host
  • Swapping due to low free memory
  • Disk errors / dying SD card
  • Unstable voltage
  • ElectroMagnetic Interference (EMI) affecting proper signal transmission or leading to high resend rates

Will start by using a new sd card and see how that goes, I’ve also added the MCU and the PI temperature to the dashboard in order to have them visible at all time.

Here’s a what my printer.cfg and moonraker.conf look like:

[include mainsail.cfg]

# Other settings


# This file contains common pin mappings for the Duet3 Mini 5+. To use
# this config, the firmware should be compiled for the ATSAMD51P20
# with a "25Mhz crystal", "16KiB bootloader", and USB communication.

# To flash the board, double tap the board's reset button to enter the
# bootloader and then run: make flash FLASH_DEVICE=/dev/ttyACM0

# See docs/Config_Reference.md for a description of parameters.


# Pins for reference:
# Driver Step Pins - 0:PC26, 1:PC25, 2:PC24, 3:PC19, 4:PC16, 5:PC30, 6:PC18
# Driver Dir pins - 0:PB3, 1:PB29, 2:PB28, 3:PD20, 4:PD21, 5:PB0, 6:PA27
# Driver Enable - !PC28
# Uart addresses - 0:0 1:1 2:2 3:3 4:!0 5:!1 6:!2 | "!" is for inverted select pin
# Thermistor Pins - T0:PC0, T1:PC1, T2:PC2
# Vssa Sense:PB4 | Vref Sense:PB5
# Current Sense resistor for drivers - .076ohm
# SPI lines:{PD11, PC7} -> Shared SerCom#7, SPIMosi:PC12, SPIMiso:PC15, SPISCLK:PC13
# Vin Monitor:PC3, uses 11:1 voltage divider
# LED's - Diag:PA31, Act:PA30
# 12864 LCD - LCDCSPIN:PC6, ENCA:PC11, ENCB:PD1, ENCSW:PB9, LCD A0:PA2, LCDBeep:PA9, LCD Neopixel Out:PB12 (shared with IO3.out)
# Neopixel Out - PA8
# Serial0 - TX:PB25, RX:PB24 (USB)
# Serial1 - TX:PB31, RX:PB30
# SBC SPISS pin:PA6, SBCTfrReady:PA3, SerComPins:{PA4, PA5, PA6, PA7}
# CAN Pins - TX:PB14 RX:PB15
# Heaters, Fan outputs - {Out0:PB17 Out1:PC10 Out2:PB13 Out3:PB11 Out4:PA11, Out5:PB2, Out6:PB1} | Out6 is shared with VFD_Out
# GPIO_out - {IO1:PB31 IO2:PD9 IO3:PB12 IO4:PD10} IO4 is shared with PSON
# GPIO_in - {IO1:PB30 IO2:PD8 IO3:PB7 IO4:PC5 IO5:PC4 IO6:PC31}
# Driver Diag - {D0:PA10, D1:PB8, D2:PA22, D3:PA23, D4:PC21, D5:PB10, D6:PA27}
# Mux Pin - PD0
# EXP headers only support 12864 LCD's

[stepper_x]
#driver0
step_pin: PC26
dir_pin: PB3
enable_pin: !PC28
microsteps: 16
rotation_distance: 40
endstop_pin: PB30
position_endstop: 350
position_max: 350
homing_speed: 100

[tmc2209 stepper_x]
uart_pin: PA1
tx_pin: PA0
select_pins: PD0
uart_address: 0
interpolate: False                      # for improved positional accuracy
run_current: 0.600
hold_current: 0.500
sense_resistor: 0.056
stealthchop_threshold: 999999

[stepper_y]
#driver1
step_pin: PC25
dir_pin: !PB29
enable_pin: !PC28
microsteps: 16
rotation_distance: 40
endstop_pin: PD8
position_endstop: 350
position_max: 350
homing_speed: 100


[tmc2209 stepper_y]
uart_pin: PA1
tx_pin: PA0
select_pins: PD0
uart_address: 1
interpolate: False                      # for improved positional accuracy
run_current: 0.600
hold_current: 0.500
sense_resistor: 0.056
stealthchop_threshold: 999999


[stepper_z]
#driver2
step_pin: PC24
dir_pin: PB28
enable_pin: !PC28
microsteps: 16
rotation_distance: 4
endstop_pin: probe:z_virtual_endstop
#position_endstop: 0
position_min: -5
position_max: 400
homing_speed: 10.0
homing_retract_speed: 4.0
homing_retract_dist: 3.0                # allow sufficient distance for BL Touch probe
second_homing_speed: 2.0                # slowed down for improved accuracy



[tmc2209 stepper_z]
uart_pin: PA1
tx_pin: PA0
select_pins: PD0
uart_address: 2
interpolate: False                      # for improved positional accuracy
run_current: 0.600
hold_current: 0.500
sense_resistor: 0.056
stealthchop_threshold: 999999


[stepper_z1]
#driver3
step_pin: PC19
dir_pin: PD20
enable_pin: !PC28
microsteps: 16
rotation_distance: 4

[tmc2209 stepper_z1]
uart_pin: PA1
tx_pin: PA0
select_pins: PD0
uart_address: 3
interpolate: False                      # for improved positional accuracy
run_current: 0.600
hold_current: 0.500
sense_resistor: 0.056
stealthchop_threshold: 999999


[adc_scaled vref_scaled]
vref_pin: PB5
vssa_pin: PB4

[extruder]
#driver4
step_pin: PC16
dir_pin: PD21
enable_pin: !PC28
microsteps: 16
rotation_distance: 7.74818401937046
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC10 # out1
sensor_type: ATC Semitec 104GT-2
pullup_resistor: 2200
sensor_pin: vref_scaled:PC1
#control: pid
#pid_Kp: 30.089
#pid_Ki: 2.229
#pid_Kd: 101.550
min_temp: 0
max_temp: 285
max_extrude_only_distance: 500

[tmc2209 extruder]
uart_pin: PA1
tx_pin: PA0
uart_address: 0
interpolate: False                      # for improved positional accuracy
select_pins: !PD0
run_current: 0.600
hold_current: 0.500
hold_current: 0.10                      # Orbiter 2 LDO-36STH20-1004AHG(XH) default
sense_resistor: 0.056
stealthchop_threshold: 999999

[heater_bed]
heater_pin: PB17 #out1
sensor_type: Generic 3950
sensor_pin: vref_scaled:PC0
#control: pid
pullup_resistor: 2200
#pid_Kp: 61.049
#pid_Ki: 2.339
#pid_Kd: 398.344
min_temp: 0
max_temp: 100

[heater_fan heatbreak_fan]
pin: PB2
max_power: 1.0
fan_speed: 1.0                          # full cooling not required with Micro Swiss hot end but running full to stop Orion fan noise
shutdown_speed: 1.0                     # keep fan running in case Klipper shuts down in error state
#cycle_time: 0.010
kick_start_time: 0.100
heater: extruder
heater_temp: 50.0

[fan]
pin: PB1
cycle_time: 0.01
kick_start_time: 0.100
off_below: 0.06                         # Delta BFB04512VHD runs reliably at 6% PWM or above

[bltouch]
sensor_pin: PB7
control_pin: PB12
x_offset: -44
y_offset: -0
#z_offset: 2.525
samples: 2
samples_result:average
probe_with_touch_mode: true
stow_on_each_sample: false

[bed_mesh]
speed: 150
horizontal_move_z: 8
#mesh_min: 15, 15
#mesh_max: 300, 320
mesh_min: 15, 15
mesh_max: 300, 320
probe_count: 5, 5
mesh_pps: 2,2
algorithm: bicubic
bicubic_tension: 0.2
move_check_distance: 3.0
fade_start: 1
fade_end: 10


[safe_z_home]
home_xy_position: 175,175 # Change coordinates to the center of your print bed
speed: 100
z_hop: 20                 # Move up 10mm
z_hop_speed: 5

[bed_screws]
screw1: 40,20
screw2: 40,280
screw3: 320,280
screw4: 320,20

[mcu]
serial: /dev/ttyACM0

#[filament_motion_sensor filament_sensor]
#detection_length: 7.0
#extruder: extruder
#switch_pin:PD10
#runout_gcode: FILAMENT_RUNOUT

[virtual_sdcard]
path: ~/gcode_files


[printer]
kinematics: cartesian
max_velocity: 200
max_accel: 2000
max_accel_to_decel: 1000
max_z_velocity: 5
max_z_accel: 100
square_corner_velocity: 10.0

[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100


########################################
# Macro configs
########################################
# All customizations are documented in globals.cfg. Just copy a variable from
# there into the section below, and change the value to meet your needs.

[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
#variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 90.0
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
#variable_menu_temperature: [
#  {'name' : 'PLA',  'extruder' : 200.0, 'bed' : 60.0},
#  {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0},
#  {'name' : 'ABS',  'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}]
# Length of filament (in millimeters) to purge at print start.
#variable_start_purge_length: 30 # This value works for most setups.
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
#[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
[include klipper-macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work. If your config
# already has some of these sections you should merge the duplicates into one
# (or if they are identical just remove one of them).
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT # This line must be in your idle_timeout section.

[pause_resume]

[respond]

[save_variables]
filename: ~/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!!

[virtual_sdcard]
path: ~/gcode_files # UPDATE THIS FOR YOUR PATH!!!
on_error_gcode: CANCEL_PRINT

[display_status]

# Uncomment the sections below if Fluidd complains (because it's confused).
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_FAKE_BASE
#gcode: CANCEL_PRINT_FAKE_BASE {rawparams}

# See the sample-lcd.cfg file for definitions of common LCD displays.

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 1.400
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 32.503
#*# pid_ki = 1.363
#*# pid_kd = 193.801
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 67.491
#*# pid_ki = 0.913
#*# pid_kd = 1247.744
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	  -0.016250, 0.001875, 0.033125
#*# 	  0.006875, 0.021250, 0.041875
#*# 	  -0.007500, -0.013125, 0.023125
#*# tension = 0.2
#*# min_x = 156.35
#*# algo = lagrange
#*# y_count = 3
#*# mesh_y_pps = 2
#*# min_y = 156.35
#*# x_count = 3
#*# max_y = 203.65
#*# mesh_x_pps = 2
#*# max_x = 203.65
#*#
#*# [bed_mesh x1]
#*# version = 1
#*# points =
#*# 	-0.781250, -0.188750, 0.431250, 1.097500, 1.038750
#*# 	-0.703750, -0.133750, 0.393750, 1.065000, 1.647500
#*# 	-0.732500, -0.275000, 0.203750, 0.881250, 1.621250
#*# 	-0.773750, -0.326250, 0.140000, 0.821250, 1.551250
#*# 	-0.840000, -0.342500, 0.143750, 0.741250, 1.366250
#*# tension = 0.2
#*# min_x = 15.0
#*# algo = bicubic
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 15.0
#*# x_count = 5
#*# max_y = 320.0
#*# mesh_x_pps = 2
#*# max_x = 300.0

type or paste code here

Moonraker.conf:

[server]
host: 0.0.0.0
port: 7125
# Verbose logging used for debugging . Default False.
# The maximum size allowed for a file upload (in MiB).  Default 1024 MiB
max_upload_size: 1024

[file_manager]
# post processing for object cancel. Not recommended for low resource SBCs such as a Pi Zero. Default False 
enable_object_processing: False

[authorization]
cors_domains:
    https://my.mainsail.xyz
    http://my.mainsail.xyz
    http://*.local
    http://*.lan
trusted_clients:
    10.0.0.0/8
    127.0.0.0/8
    169.254.0.0/16
    172.16.0.0/12
    192.168.0.0/16
    FE80::/10
    ::1/128


[paneldue]
serial: /dev/ttyAMA0
#   The serial port in which the PanelDue is connected.  This parameter
#   must be provided.
baud: 57600
#   The baud rate to connect at.  The default is 57600 baud.
machine_name: bigjoe
#   An optional unique machine name which displays on the PanelDue's
#   Header.  The default is "Klipper".
macros:
 LOAD_FILAMENT
 UNLOAD_FILAMENT
 PANELDUE_BEEP FREQUENCY=500 DURATION=1
#   A list of newline separated "macros" that are displayed in the
#   PanelDue's "macros" tab.  These can be gcode macros or simple
#   gcodes.  A macro may contain parameters.  The default is no
#   macros will be displayed by the PanelDue.
confirmed_macros:
  RESTART
  FIRMWARE_RESTART
#  Like the "macros" option, this list is added to the macros tab.
#  When one of these macros is executed the PanelDue will prompt
#  the user with a confirmation dialog.  The default is to include
#  RESTART and FIRMWARE_RESTART.

# enables partial support of Octoprint API
[octoprint_compat]

# enables moonraker to track and store print history.
[history]

# this enables moonraker's update manager
[update_manager]
refresh_interval: 168 

[update_manager mainsail]
type: web
repo: mainsail-crew/mainsail
path: ~/mainsail

# Crowsnest update_manager entry
#### [update_manager webcamd]
#### type: git_repo
#### path: ~/crowsnest
#### origin: https://github.com/mainsail-crew/crowsnest.git

# Crowsnest update_manager entry
#[update_manager crowsnest]
#### type: git_repo
#### path: ~/crowsnest
#### origin: https://github.com/mainsail-crew/crowsnest.git
#### managed_services: crowsnest


[update_manager klipper-macros]
type: git_repo
origin: https://github.com/jschuh/klipper-macros.git
path: ~/klipper_config/klipper-macros # UPDATE THIS FOR YOUR PATH!!!
primary_branch: main
is_system_service: False
managed_services: klipper

Having a thermal throttling event on the host is surely a good way to run into such an error, as the CPU freq is significantly reduced. I would guess (without being the expert) that the change of frequency is the most critical point from a Klipper perspective.

Thanks Sineos, I would definitely agree with you on this but what’s odd here is that there’s a heatsink with a fan on the Pi, hence why I’m finding weird getting the temp warning after having removed the webcam.

It might have been there before but not once I saw it popping in the web interface during yesterday’s printing session until I removed the webcam.

As previvously stated, I’ll try some of the recommendations from your Timer to close thread and see how that goes.

Thanks

And the Pi’s PSU?
Does it provide the correct voltage with enough current?

I’ll need to recheck that as I’m using a buck converter, but from top of my head when I installed it, I was à little bit over the 5V, if that changed over time, I might go for a real 5V power supply to replace the bulk converter.

Recommended are 5.2 V

Will be ordering 2 of this, just in case: MeanWell RS-25-5 25 W 5 V 5 A