Skip to content

Installation guide for fresh systems

C0co edited this page Nov 6, 2024 · 24 revisions

Who's this guide for?

This guide is for users who:

  • Have a stock printer with stock software or
  • Dont have an open armbian system with mainline klipper or
  • Want to start with a fresh system to make it from scratch

If you followed my guide for an open armbian system with mainline klipper (FreeQIDI) already,
and you just want to add the screen functionality, please head over to my Installation guide for existing systems.

You are lucky!

I have prepared a full image ready to go for you.
Its a fresh and clean system to make it as simple for you as I can.

Whats in the box?

To understand what is included in my image, here is the list, what it is based on:

  • Armbian-unofficial_24.2.0-trunk_Mkspi_bookworm_current_6.6.17 Installed is:
  • kiauh v5.1 (v6 is in alpha state)
  • Klipper v0.12.0-289
  • Moonraker v0.9.2-6
  • and everything you need for input shaping, wifi and of course the touch screen functionality.
  • no crowsnest, klippain-shaketune or other things. Simply a pure basis for everyone

This makes it:
image On a 8GB EMMC.

Flashing the operating system (OS) image:

  1. Simply download the image file for your needs.
    You can find the full image at the releases section.
    Search for a *.rar file, download it and unpack it (you will get an *.img file).
  2. Flash the *.img file to your EMMC card or an USB flash drive (eg. by using Win32DiskImager, balenaEtcher or a similar tool).
  3. Insert the EMMC/USB drive to your printer and start it.
  4. Done.

The whole operating system with all the software is now on your printer.
As the firmware if your screen can currently only communicate with the stock operating system, you will see this now on your screen:
image
Dont worry, this is totally fine!
We will flash the screen with my firmware to make it work with an official and unmodified klipper.

Flashing the display:

To flash the display firmware, you will need a FAT32 formatted sd card.

  1. Take the matching firmware from the screen_firmwares directory
    (unsure which one to use?)
  2. Copy the *.tft file to the sd card.
  3. Make sure there is only the *.tft file on the sd card.
  4. Switch off the printer.
  5. Insert the sd card into the screens sd slot.
    It is located on the backside of the screen and a bit hidden at the first sight.
    You can see it "from the inside" of your print volume.
  6. Turn the printer on.
  7. The screen will tell you that its flashing - wait patiently untill "updated successed" is visible. (not a typo)
  8. Switch off the printer.
  9. Remove the sd card.

Creating the "perfect match" with your hardware

Your operating system and screen are now set up.
Next, we need to ensure that the subsystems (mainboard MCU and toolhead) are running the same Klipper version and adjust the configuration to match your specific hardware.

Open the Mainsail UI of your printer with a browser by entering the printer's IP address.
Don't use the modified port (10088) that you might be used to from the stock machine.
Then go to the "MACHINE" section:
image

On the right side you will find your current Klipper versions for the MCU, the toolhead (MKS_THR) and also the host:
image

You will also see a hint, that your printer cant find the toolhead (MKS_THR):
image
Dont worry, that is completely OK!
It simply says it cant find your toolhead by the default ID I set as placeholder.
In the next steps, we will adjust your printer config to match the unique ID of your toolhead.

Depending on hardware setup and liking, choose one of the following guides:

#1 Your mainboard MCU and the toolhead are on Klipper v0.12.0-289 already?

Yes, its on Klipper v0.12.0-289

To finish your configuration, we need find the unique ID of your toolhead and insert it to your printer.cfg.

  1. SSH to your printer (eg. via putty) and run the command:
    ls /dev/serial/by-id/*
    Note the device ID which will be printed like:
    image

  2. Connect to your printer via your favorite browser and replace the ID in the [mcu MKS_THR] section of the printer.cfg with the one you got before:
    image


You are done :)
Happy printing!

#2 Your mainboard MCU and the toolhead are NOT on Klipper v0.12.0-289
- and you want it the easy way?

Yes please, go easy on me!
To make it easy for you, I pre-compiled files for your subsystems.
Please download and flash them.
You can find them in the

mainboard_and_toolhead_firmwares section.
Make sure you get the version matching your Klipper.

You will finde a Toolhead_RP2040.uf2 for the toolhead and a X_4.bin for the mainboard MCU:
image

Flashing the Mainboard MCU:

  1. Format a microSD card as FAT32 (not lager in size then 32GB – maybe larger sized SD-cards will work if you create a partition not larger then 32GB).
  2. Copy the „X_4.bin“ file to this SD-card.
  3. Eject the microSD card from your computer.
  4. Shut down your printer and wait at least 30sec.
  5. Put the microSD card into the SD card slot of the printers mainboard.
  6. Turn the printer on. The mainboard STM32F402 MCU will now be flashed (which takes about 10sec, but make sure to not turn it down before 1min… just in case).

Flashing the THR toolhead:

  1. SSH to your printer (eg. via putty) and run the command ls /dev/serial/by-id/* Note the device ID which will be printed like: image

  2. Connect to your printer via your favorite browser and replace the ID in the [mcu MKS_THR] section of the printer.cfg with the one you got before: image

Put your Toolhead into "RP2 Boot" mode.

  1. Remove the back cover of the tool head.
  2. Press and hold the „boot“ button.
  3. Press and release the „reset“ button.
  4. Release the „boot“ button.

Verify if its really in "RP2 Boot" mode. You can do this by:

lsusb

This means it is in boot mode:
tut6_in_bootloaderMode
This means it NOT in boot mode:
tut6_not_in_bootloaderMode

Run lsblk and see if you can find a partition at 128MB size:

lsblk

This means it is in boot mode and the partition is "sda1":
tut5

This means it NOT in boot mode:
tut2 8
if thats the case, go back to step 1.

Flashing the firmware to the toolhead.

  1. Find the file Toolhead_RP2040.uf2 from the firmware section matching your Klipper version.
  2. Download it.
  3. Use your favourite program to copy this file to the ~/X3seriesLCD folder of your printer (eg. WinSCP).
  4. Flash the toolhead by run:
sudo cp ~/X3seriesLCD/Toolhead_RP2040.uf2 /dev/sda1
  1. Shut the system down (sudo shutdown) and shut it off (switch off).
  2. Wait a few seconds and turn the printer on.

As the final step, you need to flash the display.

Flashing the display:

Please head over to the next chapter:
https://github.com/Phil1988/FreeDi/wiki/Flashing-the-display

#3 You are a hardliner and want to compile it on your own?

Yessir, I want it the hard way!

Compiling the toolhead firmware

Run:

cd ~/klipper
make menuconfig

set it according to this:
tut1
save with q

Run:

make clean
make -j4

Flashing the tool head

Bring the toolhead into "RP2 Boot" mode (check the easy section how to do that).
Check the partition with lsblk - in my case "sda1".
Run the following command adjusted to the partition you found.

sudo cp ~/klipper/out/klipper.uf2 /dev/sda1

Compiling the mainboard mcu firmware

Run:

cd ~/klipper
make menuconfig

set it according to this:
tut6
save with q

Run:

make clean
make -j4

This will generate a „klipper.bin“ file in the /home/mks/klipper/out/ folder.
Use your favourite program to get this file onto your computer (I am using WinSCP).
Rename it to „X_4.bin“ and flash it like in the easy section.

As the final step, you need to flash the display.

Flashing the display:

Please head over to the next chapter:
https://github.com/Phil1988/FreeDi/wiki/Flashing-the-display