Skip to content

linhungsam/Sovol-SV08-Mainline

 
 

Repository files navigation

Sovol-SV08-Mainline

USE THE MAIN REPO FOR STABILITY >>> Rappetor/Sovol-SV08-Mainline

Getting the Sovol SV08 onto mainline Klipper

This repository will describe installing mainline/regular klipper (via KIAUH) on your Sovol SV08 with the BTT CB1 image.

Run it from either eMMC or SD card, you choose.

TL;DR: make a backup of klipper config, remove the eMMC from the printer, write CB1 image to eMMC, change BoardEnv.txt and system.cfg, put the eMMC back in the printer, install KIAUH; klipper, moonraker, and mainsail (and optional extras), create firmware(s), flash the tool head MCU and board MCU. DONE!


READ ME FIRST!

Video Guides can be out of date. Please always refer to this repo as the main source for up to date information.

WE ARE NOT RESPONSIBLE FOR DAMAGE TO YOUR PRINTER.

That being said, all steps have been thoroughly tested by multiple people in the community. Please follow the steps exactly and carefully and you will have a good working printer at the end. If you get stuck at some point or have any questions please create an issue or find support on the Sovol (official and unofficial) Discord.



This guide uses color codes to showcase important info.

Caution

If you see text inside a red box, you NEED to read what is in the box.

Important

If you see text inside the purple box, it's an important piece of information.

Note

If you see text inside a blue box, this info is typically a helpful tip or a useful note.

Ok, now you can continue.

WORK IN PROGRESS

Note

This is a work in progress, and some work needs to be done. You are the guinea pig ;)
Found something that doesn't work (properly), please share and contribute!

INDEX

PREREQUISITES

  • First, create a backup of all the config files on your original Sovol SV08. You can do this in the web/mainsail interface -> Machine -> Select all files/folders -> Download.
    • Optionally you can also SSH or SFTP into your machine (port: 22, username/password: sovol/sovol) and backup additional .sh scripts in the /home/sovol/ folder.
    • For example use PuTTY for SSH and WinSCP for SFTP (SSH File Transfer Protocol).
  • You WILL need the printer.cfg later in this process (for the /dev/serial/by-id/usb-Klipperstm32f103xe serials).
  • You need either a 'Makerbase MKS EMMC-ADAPTER V2 USB 3.0' USB adapter or 'Makerbase MKS MICROSD TO EMMC ADAPTER' to be able to read/write the eMMC.
    • It is recommended to get yourself a separate eMMC module (MKS eMMC Module) on which you install the new OS Image and mainline klipper. This way you always have a backup (eMMC) of a working printer.
  • If you go for the 'method 2' you need a big enough MicroSD card (it's also possible to run everything from the SD card).
  • You will need an ST-Link V2 (Mini) with the STM32CubeProgrammer software installed to be able to update/flash the MCU firmware.
  • The files used for this guide can now be found together in the GitHub folder /files-used/ HERE

EMMC Sellers

QIDI (USA/EU/UK/CA/JP/AU)

Aliexpress (China)

Kingroon (China)

Note

Depending on which model you purchase you may also need a MicroSD card reader, follow the guide but when we mention the USB adapter you will need to use your MicroSD card reader along with the 'MICROSD TO EMMC ADAPTER'

STEP 1 - REMOVING THE eMMC FROM THE PRINTER

Caution

POWER OFF AND UNPLUG THE PRINTER FROM THE OUTLET.

  1. Put the printer on its back, so you have access to the underside of the printer.
  2. Remove the metal plate by removing the 6 screws.
  3. You can now see the eMMC module on the board, remove the 2 screws that are holding it in, and carefully remove the eMMC module.
    • Take note of the direction of the eMMC module (hint; you can also see an arrow on the board which way the module goes)

STEP 2 - FLASHING MEDIA

First, download the BIGTREETECH CB1 Linux image (the original Sovol SV08 image was also based on this): https://github.com/bigtreetech/CB1

Here we can use 3 methods:

Method 1: Write the CB1 image directly to the eMMC and use it that way

Method 2: Write the CB1 image to an SD card and use that to get the CB1 image on the eMMC.

Method 3: Choose to run everything from the SD card and stop at Method 2.2

Tip

Some people get an error while booting, or it doesn't want to boot at all, after writing the image with Balena Etcher. Some have had success writing the image with the Raspberry Pi Imager instead.


METHOD 1: WRITE IMAGE DIRECTLY TO eMMC

  1. Download the MINIMAL BIGTREETECH image. Careful, there's also a full image that has an unknown version of Klipper already installed. Go to: https://github.com/bigtreetech/CB1/releases
  2. Put the eMMC module in the USB adapter (again, mind the direction of the module, there is an arrow on the adapter) and put the USB adapter in your computer.
  3. Use BalenaEtcher to write the image to the eMMC
    • Used in this example: balenaEtcher-win32-x64-1.19.21.zip (portable, so doesn't need an installer)
    • Open Balena Etcher
      -> Choose "Flash from file", browse and choose the downloaded CB1 image
      -> Select the eMMC drive (e.g. Generic USB STORAGE DEVICE USB device)
      -> Flash! (this will erase everything on the eMMC!)
  4. After the flash is complete you can close BalenaEtcher. If everything is alright you now see a FAT drive called 'BOOT' (if not, eject the USB adapter and put it back in)

You can now continue to STEP 3


METHOD 2: WRITE IMAGE TO SD -> eMMC

  1. Write the image to the eMMC chip

  2. Use BalenaEtcher to write the image to the SD card

    • Used in this example: balenaEtcher-win32-x64-1.19.21.zip (portable, so doesn't need an installer)
    • Open Balena Etcher
      -> Choose "Flash from file", browse and choose the downloaded CB1 image
      -> Select the SD card
      -> Flash! (this will erase everything on the SD card!)

Note

Sidenote here: you could, if you choose here, run the printer from the SD card and skip the whole eMMC. Just so you know ;-)

  1. Put the eMMC module in the USB adapter (again, mind the direction of the module, there is an arrow on the adapter) and put the USB adapter in your computer.

  2. We need to clear all the partitions from the eMMC (this will erase everything on the eMMC!) :

    • In Windows open the command prompt (Win-R -> cmd) and run diskpart (be careful with diskpart, we don't want to erase the wrong disk here!)
    • In diskpart do list disk and see what disk is your eMMC
    • In diskpart run select disk <nr> where is the number of your eMMC. Please make sure this is the correct disk before you continue!
    • In diskpart run clean and it will erase everything/all partitions from the eMMC disk.
    • In diskpart run exit to exit

Diskpart

Please continue to STEP 3 and then come back here!

  1. If everything is ok you should have booted from the SD card, and it's time to copy all the contents to the eMMC and make it bootable.
    • First, check if the eMMC is recognized and available:
      • Run the command fdisk -l and you should see some storage devices including the eMMC (e.g. /dev/mmcblk1 for the SD card and /dev/mmcblk2 for the eMMC).
    • Run the command sudo nand-sata-install:
      • Choose the option 'Boot from eMMC - system on eMMC'.
    • It will now create and format a partition (ext4) on the eMMC, and it will copy all its contents from the SD card to the eMMC.
    • When it's done power off the SV08, remove the SD card, and boot from the eMMC. If everything has gone correctly you should now boot from the eMMC and can continue with STEP 4.

STEP 3 - CHANGES TO THE BOARDENV.TXT & SETUP WI-FI

To make the CB1 image setup correctly we need to copy a file and make a few changes to the BoardEnv.txt. Also, we need to set up Wi-Fi credentials (if not connected via ethernet) in the system.cfg

  1. Please copy the sun50i-h616-sovol-emmc.dtb file from the /files-used/dtb-files/ GitHub folder HERE to your 'BOOT' drive /dtb/allwinner/ folder.
  2. Go to the 'BOOT' drive and make a BACKUP of 'BoardEnv.txt' on your hard disk just in case.
  3. Open 'BoardEnv.txt' in your favourite text editor.
  4. Replace the content ABOVE the #--------# line (we KEEP what is under there) with the following items (see picture below, green = copy/pasted, red = don't touch and keep as it is):
    bootlogo=false
    overlay_prefix=sun50i-h616
    fdtfile=sun50i-h616-sovol-emmc
    console=display
    overlays=uart3
    overlays=ws2812
    overlays=spidev1_1
    It will now look something like this:
    BoardEnv.txt contents

Note

NOTE 1: by setting bootlogo=false you get the Linux boot messages on the HDMI display, if you set bootlogo=true you only see them when connecting a keyboard and pressing a key.
NOTE 2: fdtfile=sun50i-h616-sovol-emmc supports both eMMC and SD cards but will, obviously, only boot from one (according to the BTT CB1 docs the SD card has priority over eMMC but there have been reports of it being the other way around; if it boots from eMMC and not the SD card please make sure the eMMC is empty or non-bootable or just remove it from the printer).

  • Save your changed BoardEnv.txt!
  1. Change the Wi-Fi credentials in the 'system.cfg'

    • Optional: uncomment the hostname and set the hostname to e.g. "SV08"
    • Save changes to the system.cfg

Important

if you are using an HDMI screen you will need to set the screen rotation to "inverted"

  1. Eject the USB adapter from your computer then put the eMMC (and SD card in case of method 2) back into the printer and boot it, then:
    • SSH into the printer (find the IP address on your router or use the configured hostname), username/password: biqu/biqu
    • If everything is ok your printer will boot nicely, you can SSH into the printer, and you are done with this step and ready to install mainline Klipper. You can also continue Method 2, point 6, and finalize writing the system to eMMC!

STEP 4 - INSTALL MAINLINE KLIPPER

Time for the fun stuff! Now we shall install KIAUH, Klipper, Moonraker, etc. Please SSH into your printer and then do the following steps.

  1. First, we will update the OS:

    sudo apt update && sudo apt upgrade
  2. Then install git (which might already be installed) and KIAUH with the following commands:

    sudo apt-get update && sudo apt-get install git -y
    cd ~ && git clone https://github.com/dw-0/kiauh.git
  3. Start KIAUH with the following command :

    ./kiauh/kiauh.sh
  4. Install Klipper, Moonraker, Mainsail, and Crowsnest (in this order) via KIAUH.

    • So run KIAUH and choose: option '1) [Install]' and install those items (using default options, download recommended macros; Yes).
    • Crowsnest install asks to reboot the printer, please do so.

Important

If you are using an HDMI screen, now is the time to install klipperscreen, do this BEFORE crowsnest so you dont have to reboot twice.

  1. Install Numpy (needed for input shaping)

    sudo apt update
    sudo apt install python3-numpy python3-matplotlib libatlas-base-dev libopenblas-dev
    ~/klippy-env/bin/pip install -v numpy
  2. Install Moonraker-timelapse

    cd ~/
    git clone https://github.com/mainsail-crew/moonraker-timelapse.git
    cd ~/moonraker-timelapse
    make install
    • Then edit your ~/printer_data/config/moonraker.conf and add the following lines:
    [update_manager timelapse]
    type: git_repo
    primary_branch: main
    path: ~/moonraker-timelapse
    origin: https://github.com/mainsail-crew/moonraker-timelapse.git
    managed_services: klipper moonraker
    
    [timelapse]
    ##   Following basic configuration is default to most images and don't need
    ##   to be changed in most scenarios. Only uncomment and change it if your
    ##   Image differ from standart installations. In most common scenarios 
    ##   a User only need [timelapse] in their configuration.
    output_path: ~/timelapse/                ##   Directory where the generated video will be saved
    frame_path: /tmp/timelapse/              ##   Directory where the temporary frames are saved
    ffmpeg_binary_path: /usr/bin/ffmpeg      ##   Directory where ffmpeg is installed
    • After this you can configure the timelapse in your Mainsail Interface Settings.
    • Check your slicer (e.g. Orca Slicer), your printer profile should have the timelapse frame g-code. You will find this under:
      -> Printer settings
      -> Machine G-Code
      -> 'Before layer change G-code'
      -> If not in there, add: TIMELAPSE_TAKE_FRAME
  3. You have now installed mainline Klipper with the Mainsail web interface (and addons)! But there is more to be done to get it all working properly..

    • If you haven't rebooted after installing Crowsnest:
      sudo reboot
    • After the board has rebooted, in your browser go to the Mainsail web interface (via the IP address or hostname) and check if it's running.
    • It will give an error since we still have to put our backed-up printer.cfg back.

STEP 5 - CONFIGURE PRINTER/KLIPPER & ADDONS

Next, we have to configure our printer and put back some addons Sovol has added (probe_pressure and z_offset_calibration) and get the basics working.

Please use the files provided HERE in the /files-used/ GitHub folder. Some items (like the 'z_offset_calibration' script) have been fixed to work with the newest version of Klipper and other items in the printer.cfg have been changed/improved e.g. for a more silent and cooler (motor) running printer.

  1. RESTORE THE SOVOL ADDONS (from the /files-used/sovol-addons/ github directory) HERE:

    • Use an SFTP program (like WinSCP) to connect to the printer (IP address or hostname, port: 22, username/password: biqu/biqu)
    • Put the files 'probe_pressure.py' and 'z_offset_calibration.py' into the '~/klipper/klippy/extras/' folder.
  2. GRAB BASE PRINTER CONFIGURATION (from the /files-used/config/ github directory) HERE:

    • Copy the entire config folder to the printer ~/printer_data/config folder.

    • this folder contains the following
      options\*
      printer.cfg
      sovol-macros.cfg
      saved_variables.cfg
      crowsnest.conf

    • IMPORTANT: Open your backup of your printer.cfg and copy the correct serials under [mcu] and [mcu extra_mcu] (/dev/serial/by-id/usb-Klipper_stm32f103xe_xxxx) to your new printer.cfg

  3. Do a firmware_restart (or reboot the whole printer) and you should have a working SV08.

  4. Update the slicer start g-code. The START_PRINT macro has been updated/improved: uses your actual bed temperature for meshing etc., does a QGL with home Z, and does a Z_OFFSET_CALIBRATION before each print.

    • Go to OrcaSlicer and edit the printer settings :
      -> Machine
      -> G-code
      -> Change your 'START_PRINT' line to this:

       START_PRINT EXTRUDER_TEMP=[nozzle_temperature_initial_layer] BED_TEMP=[bed_temperature_initial_layer_single]
    • Now you can print and use the sovol presets like before!

Note

NOTE 1: all the .sh scripts in the macros have been commented out and there is a basic but reduced version of the sovol menu. It has all the basics to get you going.
NOTE 2: the [adxl345] and [resonance_tester] configs have been commented out at this point, the tool head MCU needs a new firmware for this. You uncomment/enable them again after Step 8.


STEP 6 - STOCK FIRMWARE BACKUP

Important

When connecting the ST-Link to the printer, make sure the printer is powered OFF. The MCU will be powered by the ST-Link.

It's important to make a backup of the current (stock) firmware. This way you can always revert to this stock configuration. These steps apply to both the tool head MCU and mainboard MCU.

  1. First, make sure you have a properly installed ST-Link with the STM32CubeProgrammer software.

Tip

Does your (clone) ST-Link not work with STM32CubeProgrammer and e.g. only has a single digit serial number? Try the older version of the flashing program instead, you can find it here: https://www.st.com/en/development-tools/stsw-link004.html. The steps below explain the STM32CubeProgrammer but it should be mostly the same for the old program but with a different interface.

  1. Turn the printer OFF and remove the ST-Link from your computer, next connect the ST-Link to your board (either tool head or mainboard).

    • MAKE SURE YOU WIRE THIS CORRECTLY, the pinout on the boards is (SV08 -> ST-Link Mini):
      • 3V3 -> 3.3V
      • IO -> SWDIO
      • CK -> SWCLK
      • G -> GND
    • Refer to your ST-Link manual for the pinout on the adapter (not all ST-Links have the exact same pinout)!

Caution

Mind the orientation of the boards in pictures below, refer to the markings on the mainboard/toolhead!

Mainboard ST-Link pins location:

mainboard st-link pins location

Toolhead ST-Link pins location:

toolhead st-link pins location

  1. Insert the ST-Link into your computer (printer stays off), open the STM32CubeProgrammer software, and press CONNECT. It should now connect and populate the middle screen with memory stuff.
  2. Please select Read all from the Read menu, this will read everything and set the correct size (to save).

read all

  1. Please select Save As .. from the Read menu and save the current firmware (e.g. toolhead_original_firmware.bin or mainboard_original_firmware.bin).

save as

Caution

Make sure the firmware backup file is 128k. If it is 1 Kilobyte it is too small, and you won't be able to return to the old firmware. In case that already happened here is a firmware backup of a SV08 tool head, printer delivered to the EU on 2024-06-28.


STEP 7 - FLASH KATAPULT BOOTLOADER

Important

When connecting the ST-Link to the printer, make sure the printer is powered OFF. The MCU will be powered by the ST-Link.
Also make sure your ST-Link has the latest firmware, use the STM32CubeProgrammer application 'Firmware upgrade' button for this.

To make life easier in the future we are going to flash Katapult to our MCUs (we flash Katapult on both the mainboard MCU and the toolhead MCU). This is a bootloader that makes it possible to flash Klipper firmware without the ST-Link via CANBus, USB or UART by the Host.

  1. Switch the printer on, SSH into the printer, and install Katapult:

    • Run this command to install Katapult:
    cd ~ && git clone https://github.com/Arksine/katapult
    • Install pyserial with (we need this later to flash the firmware)
    pip3 install pyserial
  2. When it's done, do

    cd ~/katapult && make menuconfig

    In menuconfig select the following options :
    Katapult makemenu config settings

  3. Press Q to quit and save changes.

  4. Run the commands to build the firmware (katapult.bin):

    make clean
    make
  5. Grab the file ~/katapult/out/katapult.bin (e.g. with an SFTP program like WinSCP) and store it on the computer. You can use this Katapult firmware for both the tool head and the mainboard.

  6. Turn OFF the printer again and after it's off insert the ST Link again into the computer and start the STM32CubeProgrammer software and CONNECT.

  7. Once connected, on the left side of the software go to the tab 'Erasing & Programming' and execute a Full chip erase

Full chip erase

  1. Time to flash! Go back to the 'Memory & File editing' tab, click 'Open file', and select the katapult.bin, then press the 'Download' button to write the firmware.

Open file

Download

Done! The Katapult bootloader is on the MCU! Please click on 'Disconnect' and then remove the ST-Link from the computer and the board. Do this for both the tool head MCU and the mainboard MCU.


STEP 8 - FLASH KLIPPER FIRMWARE on MCUs

Note

The standard Klipper firmware works on both the toolhead MCU and the mainboard MCU. Originally Sovol made multiple changes to the stm32f1.c source for the firmware but they are not mandatory. Only now, the printer starts up silently; no fans, no light, and no display during boot. You CAN get some of this functionality back by enabling GPIO pins during startup, see notes below make menuconfig.

Tip

For future Klipper firmware updates, after completing the steps below, you only have to run the script at step 8.7.

It's time to create and flash the Klipper firmware! In the future, you only have to do this step when you need to update your Klipper firmware. This section assumes you already have Katapult flashed and pyserial (step 7.1) installed.

  1. Switch on the printer and SSH into the printer.

  2. Open the file printer.cfg. Look at the [mcu] and [extra_mcu] sections, and copy-paste only the section circled in red for each MCU, we will need it later:

alt text

  • If you have this in your printer.cfg:

alt text

You have to replace each ID to have the same pattern as above. To do that, find the correct serial name for the MCU with the command. AND READ THE WARNING BELOW!

ls -la /dev/serial/by-id/

You will have this :

alt text

Copy the blue part to replace ttyACM0 or ttyACM1 in your printer.cfg. At the end, you should have this (with your digits):

alt text

Warning

WARNING: When you accidently switch the mcu and extra_mcu serials bad things can happen. THE HEATER WILL TURN ON FULL BLAST! This is bad, you don't want this.

To be 100% sure you have the correct serial linked to the correct MCU please check your serials with ls /dev/serial/by-id/ and disconnect the USB plug from the toolhead (see image below). Do a ls /dev/serial/by-id/ again and see what serial is still there (this is your mcu serial) and what serial disappeared (this is your extra_mcu serial). Plug the connector back in and do another ls /dev/serial/by-id/ to confirm you have indeed the correct mcu and extra_mcu serials.

Toolhead disconnect USB

Note

The correct serial for our MCU's in the printer.cfg always begins with usb-Klipper_stm32f103xe_. If you only found serials that start with usb-Katapult_stm32f103xe_ when doing ls /dev/serial/by-id/ please replace Katapult with Klipper for the serials in your printer.cfg. It is possible your serials only contain usb-Katapult_stm32f103xe_ at the moment because the MCU is already in DFU mode, ready to receive the Klipper firmware. After flashing the Klipper firmware it will become usb-Klipper_stm32f103xe_.

  1. Download the script Automatic MCU script update and copy it in your ~/Klipper folder on the printer.

  2. Edit it with nano to change the ID of each MCU with what you have copied at 2:

sudo nano ~/klipper/update_klipper_mcus_sv08.sh
  • Replace XXXXXXX with the [mcu] serial ID, and YYYYYYY with the [extra mcu] serial ID :

printer.cfg
alt text

update_klipper_mcus_sv08.sh

#Replace each XXXXXXXX and YYYYYYYY serial number with the one you find in your printer.cfg file (we only need the part after 'usb-Klipper_stm32f103xe_')
#HOSTSERIAL is found under [mcu]
#TOOLHEADSERIAL is found under [extra mcu]

# I'm a string, so I look like: HOSTSERIAL='XXXXXXXX'
HOSTSERIAL='XXXXXXXX'

# I'm an array so I look like: TOOLHEADSERIAL=('YYYYYYY')
# For multiple serials/toolheads use (mind the space in between items!): TOOLHEADSERIAL=('YYYYYYYY1' 'YYYYYYYY2' 'YYYYYYY3')
TOOLHEADSERIAL=('YYYYYYY')
  • You should now have this in the script :
#Replace each XXXXXXXX and YYYYYYYY serial number with the one you find in your printer.cfg file (we only need the part after 'usb-Klipper_stm32f103xe_')
#HOSTSERIAL is found under [mcu]
#TOOLHEADSERIAL is found under [extra mcu]

# I'm a string, so I look like: HOSTSERIAL='XXXXXXXX'
HOSTSERIAL='32FFD9054747363035861857-if00'

# I'm an array so I look like: TOOLHEADSERIAL=('YYYYYYY')
# For multiple serials/toolheads use (mind the space in between items!): TOOLHEADSERIAL=('YYYYYYYY1' 'YYYYYYYY2' 'YYYYYYY3')
TOOLHEADSERIAL=('50FF6C068367515511180667-if00')

  1. Save the file with Ctrl + X

  2. Make the script executable :

sudo chmod +x ~/klipper/update_klipper_mcus_sv08.sh
  1. You can now use the script with :
cd "$HOME/klipper" && ./update_klipper_mcus_sv08.sh
  1. In the first menuconfig screen for the HOST,choose the following option and add PA1,PA3 on the last line (GPIO pins , if you want MCU fan and light during boot), when ready press Q to quit & save :

alt text

Note

Because we are using Katapult as the bootloader, make sure you set the 8 KiB bootloader offset.

  1. In the second menuconfig screen for the TOOLHEAD,choose the following option and add PA6 on the last line (GPIO pins , if you want hotend fan enabled during boot), when ready press Q to quit & save :

alt text

Note

Because we are using Katapult as the bootloader, make sure you set the 8 KiB bootloader offset.

  1. Finally follow the instructions until the end :

alt text

  1. Done! The Klipper firmware on both MCU has been updated.

  2. Restart the printer :

sudo shutdown -r now
  1. After the restart, you can uncomment the [adxl345] and [resonance_tester] parts in your printer.cfg

  2. Enjoy mainline Klipper !


BIG THANKS & CONTRIBUTE

Big thanks to all the people on the Sovol discords (both official and unofficial) who have helped or participated in this project in any way. Special thanks go out to: ss1gohan13, michrech, Zappes, cluless, Haagel, Froh - you guys rock!

Do you feel like contributing to this project/guide? That would be awesome! Please make a pull request or issue and then it can be added to the guide!


Disclaimer

This guide and all changes have been made with the best intentions but in the end, it's your responsibility and only your responsibility to apply those changes and modifications to your printer. Neither the author, contributors nor Sovol is responsible if things go bad, break, catch fire, or start WW3. You do this at your own risk!

About

Getting the Sovol SV08 onto mainline Klipper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.8%
  • Shell 10.2%