Implementing Klipper through a Raspberry Pi 4 on a Duet 6XD board

Basic Information:

Printer Model: Custom Hang Printer.
MCU / Printerboard: Duet 6XD
Host / SBC: Raspberry Pi 4
klippy.log: klippy.log (45.9 KB)

I’ve been trying to connect Klipper as an SBC to a Duet 3 MB6XD board but have encountered several issues. I have a Raspberry Pi 4 running Klipper connected to the Duet 3 MB6XD and am using Mainsail as a web interface. Following the instructions from the Klipper GitHub (klipper/config/generic-duet3-6xd.cfg at master · Klipper3d/klipper · GitHub) for the generic Duet 3 6XD configuration and flashing the firmware for the SAME70Q20B processor, which is also used on the 6HC, I kept receiving errors indicating that Moonraker couldn’t connect to the processor or that no devices were connected to /dev/serial/by-id/*. I repeatedly reflashed the Raspberry Pi 4 OS and followed the instructions until, randomly, it worked once when I set the communication interface to USB instead of Serial. However, even when it appeared to be connected to the 6XD board and no errors showed up, moving the motors and connecting sensors didn’t work.

Welcome Omer1015,

why didn’t you use/fill out the template, when starting a new topic?
I know, this might be confusing for newcomers.

Just fill the blanks in the template and you’ll get help :slight_smile:

We need the asked information to help you.

You could edit your topic or delete it and start from scratch.

Good luck, hcet14

Thank you for the warm welcome Hcet14,
I have now filled out the template!, if anyone could help identify the issue I have been running into that would be amazing

Common error in your klippy.log line 13.

serial = /dev/serial/by-id/<your-mcu-id>

Makes no sense. You need the right ID!

You may have a look here How-To Trouble-Shoot

1 Like

I have now switched OS to OctoPi instead of mainsail and have ran into an error where it can not connect to the rasperberry Pi
klippy.log (13.2 KB)
attached here is the klipply.log file as well

The error is still the same:

...
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/<your-mcu-id>: [Errno 2] No such file or directory: '/dev/serial/by-id/<your-mcu-id>'
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/<your-mcu-id>: [Errno 2] No such file or directory: '/dev/serial/by-id/<your-mcu-id>'
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/<your-mcu-id>: [Errno 2] No such file or directory: '/dev/serial/by-id/<your-mcu-id>'
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/<your-mcu-id>: [Errno 2] No such file or directory: '/dev/serial/by-id/<your-mcu-id>'
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/<your-mcu-id>: [Errno 2] No such file or directory: '/dev/serial/by-id/<your-mcu-id>'
...

because of

[mcu]
serial = /dev/serial/by-id/<your-mcu-id>

Don’t mix that up. You changed the frontend for using Klipper. Your OS is still Linux. Klipper runs under Linux. You might have a look here Klipper Architecture / Ecosystem

Did you read How-To Trouble-Shoot?

I have read through the How-To Trouble-Shoot Guide and have typed the “ls /dev/serial/by-id/*” command and it returned “/dev/serial/by-id/usb-Klipper_same70q20b_003231534A4A32513037303133303339-if00”

I have switched back to using mainsail as the frontend and it is now working without any errors however when I move a motor through the web interface none of them move.

klippy.log (881.8 KB)
On the klippy.log file refer to line “Start printer at Thu Aug 1 10:39:12 2024 (1722494352.1 2401.7)”

I do not know these boards, but I find it odd that there are no TMC driver sections in the example config

The board is made to be connected to external drivers and there are no on-board drivers. Even for the generic duet 3 6xd config file in the github (which I copied into the printer.cfg file), there are no TMC driver sections but for the generic duet 3 6hc config file (the alternative to my current board that contains built-in drivers), there are TMC sections.

I have played around the printer.cfg file to test different ports on the board. I got the IO output port to work and the input temperature to work. However, the driver ports still do not output pulse and direction.

Ok everyone, so after some time with working on trying to implement Klipper on a RPi + Duet 3 Mainboard 6XD my team and I have finally figured it out. We thought we’d put our solution here for anyone who happens to run into any issues that we had faced before.

We were able to send out pulse and direction signals from the 6XD driver ports using other ports besides the pulse port (eg: sending pulses through the direction port, and setting the direction through the enable port). Motor driver pulses can basically be sent from any port except the step driver port on the duet itself. This is because of a layer of signal processing that exists between the SAME70Q20B processor used and the step driver port.

According to the schematic of the 6XD board found on the Duet3D GitHub on the top-left of page 3, there are two 74HC08 chips that all pulse signals pass through going from the SAME70Q20B to the driver port on the board.

This 74HC08 chip is just a bunch of AND gates where all driver step ports on the processor are all being ANDed with one singular port in parallel that is coming out of the processor called step_gate (on port PD22 of SAME70Q20B). Each driver step port coming out of the processor is being ANDed with this port first then actually going to the physical driver port on the board, which means that if the step_gate port is 0 all step pulses will be ANDed with 0 (anything ANDed with 0 results in 0) so no signals will be going to the physical driver step port on the board.

To get around this, we defined a digital output pin in the printer.cfg and assigned it to the step_gate port PD22 and set it to always be high (anything ANDed with 1 makes the AND gate void)and then assigned the step and direction pins of the stepper motors and one normally would, and this worked and allowed us to use the step ports of the driver normally. Below is the additional lines of code we added to the printer config file:

[output_pin step_gate] # this custom output pin is named step_gate for convenience, the name can be changed to anything
pin: PD22 # step_gate port on the SAME70Q20B processor
pwm: False
value: 1 # setting the port to always be at high so that the AND gates are void

1 Like

Nice work! :+1:

A pull-request against the Klipper main repository with a fully working 6XD board would surely be appreciated.

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