Notes for - Duet2 + Duex5 on KLIPPER

Post Reply
User avatar
MirageC
Site Admin
Posts: 496
Joined: Fri Jul 24, 2020 12:52 pm
Has thanked: 7 times
Been thanked: 44 times

Notes for - Duet2 + Duex5 on KLIPPER

Post by MirageC »

Well, I got seduced by the dark side.... and oh god is it worth every sweat drop it took me to do the switch. Here are a few advices I can give: ( I will try to maintain and add stuff as I discover more)

1 - Follow instructions CAREFULLY! every word has an impact and contains a piece of information.
https://www.klipper3d.org/Installation.html

2 - You can select different user interfaces: UI provides the look and feel of the buttons and shortcut that you sill use to control the printer from your computer screen.
- Mainsail <- I am using this one, but might give a try to Maisail one day as I hear it is pretty good too.
- FluiddPi
- Octoprint
... and there might be others

Please Note: Flashing the Duet board (V1.04 and up) you will need to prepare the board to be flashed. Follow this section of the firmware flashing from Duet instruction:

Erase the firmware on the Duet
a) - Pressing the Erase button (for older Duets)
Image

b) - Jumpering the erase jumper
Image

c) - Remove the erase jumper as soon as the Diag LED lights up. This means you are successfully in programming mode.

d) - then the Reset button (if one is present).



3 - Flashing the Duet
Follow instruction in step #1 from here above to create the flashing firmware piece for the Duet to load it on the control board.
Note: using the raspberry pi command:

Code: Select all

ls /dev/serial/by-id/*
will return a different ID for your duet after erasing firmware, and after flashing Klipper.


4 - Utilities
- Download and install Putty - Putty allows a remote connection to the command line of your raspberry pi. very pratical to install things on your pi, right from your PC.
putty.png
- Dowload WinSCP - WinSCP allows a remote connection to your Raspberry Pi and displays the file structure as a windows explorer. From then you can load and modify your Klipper config file easily.
I personnaly have taken the habit to first copy the config file from the printer to my PC, modify the PC version and then re-upload to the pi. This avoids loading an old version from your PC by mistake and loosing all those precious infos.
winscp.png
5 - Klipper Config file
Each User interface (mainsail, fluiddpi) has potentially a different folder path to put the klipper config file on the RPI. FluiddPi puts it under: /home/pi/klipper_config
Usefull link to establish pin numbers from your duet
1 - Duet2 Layout
2 - Duex5 Layout
3 - Duet2 Pinout Table <- this is the correlation table to pin Microcontroller PIn number matching the pins from the control board. I know it is confusing....

6 -
Config File
Here is my integral printer.cfg file as it is today:
Lines that start with "#" are considered as comments and will not be treated by the firmware, they are for your own notes. feel free to create a structure that brings clarity to you.
Order appearance of code lines does not seam to have an impact for most of commands. I noticed that if you define a [multi_pin] section, it needs to be declared before calling it elsewhere. I used that for the HevACS to define a group of pins to be treated separately.

Code: Select all

# This file contains common pin mappings for Duet2 Eth/Wifi boards
# that have the Duex expansion board. To use this config, the firmware
# should be compiled for the SAM4E8E.

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

## Drivers
# Here are the pins for the 10 stepper drivers supported by a Duet2 board
# | Drive |  DIR pin |  STEP pin |  ENDSTOP pin |  SPI EN pin |
# |-------|----------|-----------|--------------|-------------|
# | X     |  PD11    |  PD6      |  PC14        |  PD14       |
# | Y     |  PD12    |  PD7      |  PA2         |  PC9        |
# | Z     |  PD13    |  PD8      |  PD29        |  PC10       |
# | E0    |  PA1     |  PD5      |  PD10        |  PC17       |
# | E1    |  PD9     |  PD4      |  PC16        |  PC25       |
# | E2    |  PD28    |  PD2      |  PE0*        |  PD23       |
# | E3    |  PD22    |  PD1      |  PE1*        |  PD24       |
# | E4    |  PD16    |  PD0      |  PE2*        |  PD25       |
# | E5    |  PD17    |  PD3      |  PE3*        |  PD26       |
# | E6    |  PC0     |  PD27     |  PA17*       |  PB14       |
# Pins marked with asterisks (*) are only assigned to these functions
# if no duex is connected. If a duex is connected, these endstops are
# remapped to the SX1509 on the Duex (unfortunately they can't be used
# as endstops in klipper, however one may use them as digital outs or
# PWM outs). The SPI EN pins are required for the TMC2660 drivers (use
# the SPI EN pin as 'cs_pin' in the respective config block). The
# **enable pin for all steppers** is TMC_EN = !PC6.
#
## Fans
# | FAN  |          PIN          |
# |------|-----------------------|
# | FAN0 |  PC23                 |
# | FAN1 |  PC26                 |
# | FAN2 |  PA0                  |
# | FAN3 |  sx1509_duex:PIN_12*  |
# | FAN4 |  sx1509_duex:PIN_7*   |
# | FAN5 |  sx1509_duex:PIN_6*   |
# | FAN6 |  sx1509_duex:PIN_5*   |
# | FAN7 |  sx1509_duex:PIN_4*   |
# | FAN8 |  sx1509_duex:PIN_15*  |
# Pins marked with (*) assume the following sx1509 config section:
#[sx1509 duex]
#i2c_address: 62
#
## Heaters and Thermistors
# | Extruder Drive |  HEAT pin |  TEMP pin |
# |----------------|-----------|-----------|
# | BED            |  PA19     |  PC13     |
# | E0             |  PA20     |  PC15     |
# | E1             |  PA16     |  PC12     |
# | E2             |  PC3      |  PC29     |
# | E3             |  PC5      |  PC30     |
# | E4             |  PC8      |  PC31     |
# | E5             |  PC11     |  PC27     |
# | E6             |  PA15     |  PA18     |
#
## Misc pins
# |    Name     |   Pin   |
# |-------------|---------|
# | ZProbe_IN   |  PC1    |
# | PS_ON       |  PD15   |
# | LED_ONBOARD |  PC2    |
# | SPI0_CS0    |  PC24   |
# | SPI0_CS1    |  PB2    |
# | SPI0_CS2    |  PC18   |
# | SPI0_CS3    |  PC19   |
# | SPI0_CS4    |  PC20   |
# | SPI0_CS5    |  PA24   |
# | SPI0_CS6    |  PE1*   |
# | SPI0_CS7    |  PE2*   |
# | SPI0_CS8    |  PE3*   |
# | SX1509_IRQ  |  PA17*  |
# | SG_TST      |  PE0*   |
# | ENC_SW      |  PA7    |
# | ENC_A       |  PA8    |
# | ENC_B       |  PC7    |
# | LCD_DB7     |  PD18   |
# | LCD_DB6     |  PD19   |
# | LCD_DB5     |  PD20   |
# | LCD_DB4     |  PD21   |
# | LCD_RS      |  PC28   |
# | LCD_E       |  PA25   |
# Pins marked with one asterisk (*) replace E2_STOP-E6_STOP if a duex is present
# For the remaining pins check the schematics provided here: https://github.com/T3P3/Duet
# https://duet3d.dozuki.com/Wiki/Duet_2_Pinout_table


####################################################################
############################ XY Axis ###############################
####################################################################

#__________________________ ON DRIVE X ____________________________
[stepper_x]
step_pin: PD6
dir_pin: PD11
enable_pin: !PC6
microsteps: 16
rotation_distance: 40
full_steps_per_rotation: 400
endstop_pin: ^PC14
position_endstop: 0
position_max: 280
homing_speed: 50.0
homing_retract_dist: 5.0
#second_homing_speed: 10 

[tmc2660 stepper_x]
cs_pin: PD14 				# X_SPI_EN Required for communication
spi_bus: usart1 			# All TMC2660 drivers are connected to USART1
interpolate: True 			# 1/16 micro-steps interpolated to 1/256
run_current: 2.00
sense_resistor: 0.051
idle_current_percent: 20

#__________________________ ON DRIVE Y ____________________________
[stepper_y]
step_pin: PD7
dir_pin: PD12
enable_pin: !PC6
microsteps: 16
rotation_distance: 40
full_steps_per_rotation: 400
endstop_pin: ^PA2
position_endstop: 0
position_max: 280
homing_speed: 50.0
homing_retract_dist: 5.0
#second_homing_speed: 10 

[tmc2660 stepper_y]
cs_pin: PC9
spi_bus: usart1
interpolate: True
run_current: 2.00
sense_resistor: 0.051
idle_current_percent: 20


####################################################################
############################ Z Axis ################################
####################################################################

#__________________________ ON DRIVE E2 ____________________________
[stepper_z]
step_pin: PD2
dir_pin: !PD28
enable_pin: !PC6
microsteps: 16
rotation_distance: 4 				
full_steps_per_rotation: 200
gear_ratio: 5.18:1
endstop_pin: probe:z_virtual_endstop
position_max: 280
position_min: -0.5

[tmc2660 stepper_z]
cs_pin: PD23
spi_bus: usart1
interpolate: True
run_current: 0.800
sense_resistor: 0.051


#_________________________ ON DRIVE E3 ___________________________
[stepper_z1]
step_pin: PD1
dir_pin: !PD22
enable_pin: !PC6
microsteps: 16
rotation_distance: 4 				
full_steps_per_rotation: 200
gear_ratio: 5.18:1

[tmc2660 stepper_z1]
cs_pin: PD24
spi_bus: usart1
interpolate: True
run_current: 0.800
sense_resistor: 0.051


#_________________________ ON DRIVE E4 ___________________________
[stepper_z2]
step_pin: PD0
dir_pin: !PD16
enable_pin: !PC6
microsteps: 16
rotation_distance: 4 				
full_steps_per_rotation: 200
gear_ratio: 5.18:1

[tmc2660 stepper_z2]
cs_pin: PD25
spi_bus: usart1
interpolate: True
run_current: 0.800
sense_resistor: 0.051


#__________________________ BLTouch ______________________________
[bltouch]
sensor_pin: ^PC1		# ^ = Activate pullup resistor to avoid floating input
control_pin: !PA15		# ! = Active low
x_offset: 22.75
y_offset: 5.21
#z_offset: 3
speed: 5
samples: 1
#sample_retract_dist: 5 
#samples_tolerance: 0.010


#__________________ SELF LEVELLING (Z_Tilt) _______________________
[z_tilt]
z_positions: 
	-38.188,-20.717
	138.021,307.493
	314.23,-20.717

points:
	20,20
	20,260
	260,260
	230,20
speed: 50
horizontal_move_z: 10

#retries: 0
#   Number of times to retry if the probed points aren't within
#   tolerance.
#retry_tolerance: 0
#   If retries are enabled then retry if largest and smallest probed
#   points differ more than retry_tolerance. Note the smallest unit of
#   change here would be a single step. However if you are probing
#   more points than steppers then you will likely have a fixed
#   minimum value for the range of probed points which you can learn
#   by observing command output.

#_____________________ SAFE Z HOMING ________________________________
[safe_z_home]
home_xy_position: 20,20  
z_hop: 10
z_hop_speed: 20.0



##################################################################
########################## EXTRUDER ##############################
##################################################################
#On drive E0
[extruder]
step_pin: PD5
dir_pin: PA1
enable_pin: !PC6
microsteps: 8
full_steps_per_rotation: 200
rotation_distance: 4.524
nozzle_diameter: 0.500
filament_diameter: 1.750
#_______________________ HEATER NOZZLE ____________________________
heater_pin: !PA20
#_________________________NOZZLE TEMP _____________________________
sensor_type: MAX31865    # PT100 Duet Daughter Board on Duex5
sensor_pin: PA24
spi_speed: 4000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB1
spi_software_miso_pin: PB0
rtd_nominal_r: 100
rtd_num_of_wires: 2
rtd_reference_r: 397
#control: pid
#pid_Kp: 22.2
#pid_Ki: 1.08
#pid_Kd: 114
min_temp: 0
max_temp: 350
pressure_advance = 0.010
max_extrude_only_distance: 150.0


[tmc2660 extruder]
cs_pin: PC17
spi_bus: usart1
interpolate: False
run_current: 0.350
sense_resistor: 0.051

#[multi_pin hevacs]
#pins: sx1509_duex:PIN_15, sx1509_duex:PIN_4    #Fan7&8

[multi_pin my_fan]
pins: PC23,PA0    #Fan 0 & 2

# Fan0
[fan]
pin: multi_pin:my_fan


# Fan1 controlled by extruder
[heater_fan nozzle_cooling_fan]
pin: PC26
heater: extruder
heater_temp: 45
fan_speed: 1.0


####################################################################
############################ BED ###################################
####################################################################
[heater_bed]
heater_pin: !PA19
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC13
#control: watermark
min_temp: 0
max_temp: 130


####################################################################
############################ MCU ###################################
####################################################################
[mcu]
serial: /dev/serial/by-id/usb-Klipper_sam4e8e_00313753383436313139303139303535-if00

#[mcu host]
#serial: /tmp/klipper_host_mcu

[sx1509 duex]
i2c_address: 62 # Address is fixed on duex boards

[static_digital_output onboard_led]
pins: !PC2

[output_pin GPIO1] # General purpose pin broken out on the duex
pin: sx1509_duex:PIN_11
pwm: False
value: 1

[virtual_sdcard]
path: ~/gcode_files

[display_status]

####################################################################
############################ ACCELEROMETER #########################
####################################################################

[mcu rpi]
serial: /tmp/klipper_host_mcu

[adxl345]
cs_pin: rpi:None

[resonance_tester]
accel_chip: adxl345
probe_points:
    150,150,20  # an example

####################################################################
############################ PRINTER ###############################
####################################################################
[printer]
kinematics: corexy
max_velocity: 1000
max_accel: 30000
max_accel_to_decel: 15000
max_z_velocity: 70
max_z_accel: 200
square_corner_velocity: 10.0

[pause_resume]
recover_velocity: 150

[input_shaper]
shaper_freq_x: 98.6  # per accelerometer
shaper_type_x: 2hump_ei
shaper_freq_y: 73.6  # per accelerometer
shaper_type_y: 3hump_ei



####################################################################
############################ FANS ##################################
####################################################################
[output_pin FAN3]
pin: sx1509_duex:PIN_12
pwm: True
hardware_pwm: True # Only hardware PWM fans are supported

[output_pin FAN4]
pin: sx1509_duex:PIN_7
pwm: True
hardware_pwm: True

[output_pin FAN5]
pin: sx1509_duex:PIN_6
pwm: True
hardware_pwm: True

[output_pin FAN6]
pin: sx1509_duex:PIN_5
pwm: True
hardware_pwm: True

[output_pin FAN7]
pin: sx1509_duex:PIN_4
pwm: True
hardware_pwm: True

#[output_pin FAN8]
#pin: sx1509_duex:PIN_15
#pwm: True
#hardware_pwm: True




####################################################################
###################### FILAMENT SENSOR #############################
####################################################################
#[filament_switch_sensor sentinel]
#pause_on_runout: true
#switch_pin: PXXX  # not mapped yet
#runout_gcode:
#	G91
#    G1 E-6 F2500
#    G1 Z 10


##############################################
################# MACROS #####################
##############################################
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
    TURN_OFF_HEATERS
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    BASE_CANCEL_PRINT


####################################################################
###################### END of manual config ########################
####################################################################

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 0.700
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 12.516
#*# pid_ki = 0.765
#*# pid_kd = 51.158
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 67.958
#*# pid_ki = 2.189
#*# pid_kd = 527.522
You do not have the required permissions to view the files attached to this post.

Ghost
What is a BOM?
Posts: 9
Joined: Sat Jul 25, 2020 1:21 am
Been thanked: 1 time

Re: Notes for - Duet2 + Duex5 on KLIPPER

Post by Ghost »

Great work and thanks a lot this will help greatly on my journey towards klipper

marciorssilva
Printed Parts ready
Posts: 42
Joined: Sat Jul 25, 2020 1:21 am

Re: Notes for - Duet2 + Duex5 on KLIPPER

Post by marciorssilva »

Almost donne with migration to Klipper, how can i define berd air Pump? Got the pump on duex.e5heat pin...

Post Reply