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!
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.
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!
- Prerequisites
- STEP 1 - Removing The eMMC From The Printer
- STEP 2 - Flashing Media
- STEP 3 - Changes To The BOARDENV.TXT & Setup WI-FI
- STEP 4 - Install Mainline Klipper
- STEP 5 - Configure Printer/Klipper & Addons
- STEP 6 - Stock Firmware Backup
- STEP 7 - Flash Katapult Bootloader
- STEP 8 - Flash Klipper Firmware On MCUs
- Big Thanks & Contribute
- Disclaimer
- 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 FTP into your machine (ftp port: 22, username/password: sovol/sovol) and backup additional .sh scripts in the /home/sovol/ folder.
- You WILL need the printer.cfg later in this process (for the /dev/serial/by-id/usb-Klipperstm32f103xe serials).
- You need a 'Makerbase MKS EMMC-ADAPTER V2 USB 3.0' USB 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.
- 8GB eMMC has been reported not to work properly. Please get yourself a 32GB MKS eMMC to avoid issues.
- 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 SD card (it's also possible to run everything from the SD card by the way).
- You will need an ST-Link V2 (Mini) with the STM32CubeProgrammer software installed to be able to update/flash the MCU firmware.
- You can reach the sFTP server on the IP of the printer, on port 22
Note
Here is one example listing for the adapter and also a 32GB eMMC module
https://www.aliexpress.us/item/3256807073480438.html
Caution
POWER OFF AND UNPLUG THE PRINTER FROM THE OUTLET.
- Put the printer on its back, so you have access to the underside of the printer.
- Remove the metal plate by removing the 6 screws.
- 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)
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
Note
Reason: it appears some people have boot issues when writing the CB1 image directly to the eMMC (board/eMMC does boot), the second method has been proven to be more successful in getting a booting eMMC. So method 1 does not work for you? Give method 2 a try, or start with method 2 directly.
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 succes writing the image with the Raspberry Pi Imager
instead.
- 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
- Used in this example 'CB1_Debian11_minimal_kernel5.16_20240319.img.xz': https://github.com/bigtreetech/CB1/releases/download/V2.3.4/CB1_Debian11_minimal_kernel5.16_20240319.img.xz
- 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.
- Use BalenaEtcher (https://github.com/balena-io/etcher/releases) 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!)
- 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
-
Write the image to the eMMC chip
- Used in this example 'CB1_Debian11_minimal_kernel5.16_20240319.img.xz': https://github.com/bigtreetech/CB1/releases/download/V2.3.4/CB1_Debian11_minimal_kernel5.16_20240319.img.xz
- Used in this example 'CB1_Debian11_minimal_kernel5.16_20240319.img.xz': https://github.com/bigtreetech/CB1/releases/download/V2.3.4/CB1_Debian11_minimal_kernel5.16_20240319.img.xz
-
Use BalenaEtcher (https://github.com/balena-io/etcher/releases) 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 ;-)
-
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.
-
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
- In Windows open the command prompt (Win-R -> cmd) and run
You can now continue to STEP 3 and then come back here!
- 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
- 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.
- First, check if the eMMC is recognized and available:
To make the CB1 image setup correctly we need to 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
- Go to the 'BOOT' drive and make a BACKUP of 'BoardEnv.txt' on your hard disk.
- Open 'BoardEnv.txt' in your favourite text editor. Take note of the existing
rootdev
(rootdev=UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx) androotfstype
(rootfstype=ext4) - Replace the content of the file with following code and replace the
rootdev
androotfstype
with what you had previously in your BoardEnv file.- If you run on eMMC
bootlogo=false overlay_prefix=sun50i-h616 fdtfile=sun50i-h616-biqu-emmc console=display overlays=uart3 overlays=ws2812 overlays=spidev1_1 #------------------------------------------------# rootdev=UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx rootfstype=ext4
- If you run on an SD card
bootlogo=false overlay_prefix=sun50i-h616 fdtfile=sun50i-h616-biqu-sd console=display overlays=uart3 overlays=ws2812 overlays=spidev1_1 #------------------------------------------------# rootdev=UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx rootfstype=ext4
Note
NOTE: 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.
- Save your changed BoardEnv.txt!
-
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"
- 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!
Time for the fun stuff! Now we shall install KIAUH, Klipper, Moonraker, etc. Please SSH into your printer and then do the following steps.
-
First, we will update the OS:
sudo apt update && sudo apt upgrade
-
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
-
Start KIAUH with the following command :
./kiauh/kiauh.sh
-
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.
-
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
-
Install Moonraker-timelapse
- See https://github.com/mainsail-crew/moonraker-timelapse for detailed information.
- First install moonraker-timelapse:
cd ~/ git clone https://github.com/mainsail-crew/moonraker-timelapse.git cd ~/moonraker-timelapse make install
- Then edit your
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
-
You have now installed mainline Klipper with the Mainsail web interface (and addons)!
- 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.
- If you haven't rebooted after installing Crowsnest:
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.
-
RESTORE THE SOVOL ADDONS (from the
/sovol-addons/
github directory):- Use an FTP program to connect to the printer (IP address or hostname, ftp port: 22, username/password: biqu/biqu)
- Put the files
'probe_pressure.py'
and'z_offset_calibration.py'
into the'/klipper/klippy/extras/'
folder.
-
CONFIGURE PRINTER (from the
/config/
github directory) :-
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
-
-
Do a firmware_restart (or reboot the whole printer) and you should have a working SV08.
-
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, do the next steps and you can use it again.
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.
-
First, make sure you have a properly installed ST-Link with the STM32CubeProgrammer software.
- Download the STM32CubeProgrammer software here: https://www.st.com/en/development-tools/stm32cubeprog.html#st-get-software
- Install the software and make sure the ST-Link is also properly installed; the software should show the serial of your ST-Link just below the CONNECT button (if not you can click on the little refresh button)
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.
-
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)!
- MAKE SURE YOU WIRE THIS CORRECTLY, the pinout on the boards is (SV08 -> ST-Link Mini):
Caution
Mind the orientation of the boards in pictures below, refer to the markings on the mainboard/toolhead!
- 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.
- Please select
Read all
from theRead
menu, this will read everything and set the correct size (to save).
- Please select
Save As ..
from theRead
menu and save the current firmware (e.g. toolhead_original_firmware.bin or mainboard_original_firmware.bin).
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.
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.
-
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
- Run this command to install Katapult:
-
When it's done, do
cd ~/katapult && make menuconfig
-
Press Q to quit and save changes.
-
Run the commands to build the firmware (katapult.bin):
make clean make
-
Grab the file
~/katapult/out/katapult.bin
(e.g. with an FTP program) and store it on the computer. You can use this Katapult firmware for both the tool head and the mainboard. -
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.
-
Once connected, on the left side of the software go to the tab 'Erasing & Programming' and execute a
Full chip erase
- 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.
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.
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.
-
Switch on the printer and SSH into the printer.
-
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:
- If you have this in your printer.cfg:
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
ls -la /dev/serial/by-id/
You will have this :
Copy the blue part to replace ttyACM0
or ttyACM1
in your printer.cfg. At the end, you should have this (with your digits):
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_
.
-
Download the script Automatic MCU script update and copy it in your
~/Klipper
folder on the printer. -
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 :
update_klipper_mcus_sv08.sh
#Replace each serial number with the one you find in your printer.cfg file
#HOSTSERIAL = [mcu]
#TOOLHEADSERIAL = [extra mcu]
HOSTSERIAL='XXXXXXX'
TOOLHEADSERIAL='YYYYYYY'
- You should now have this in the script :
#Replace each serial number with the one you find in your printer.cfg file
#HOSTSERIAL = [mcu]
#TOOLHEADSERIAL = [extra mcu]
HOSTSERIAL='34FFDA05334D593524680951-if00'
TOOLHEADSERIAL='31FF700630464E3225480643-if00'
-
Save the file with
Ctrl + X
-
Make the script executable :
sudo chmod +x ~/klipper/update_klipper_mcus_sv08.sh
- You can now use the script with :
cd "$HOME/klipper" && ./update_klipper_mcus_sv08.sh
- In the first menuconfig screen for the
HOST
,choose the following option and addPA1,PA3
on the last line (GPIO pins , if you want MCU fan and light during boot), when ready press Q to quit & save :
Note
Because we are using Katapult as the bootloader, make sure you set the 8 KiB bootloader offset.
- In the second menuconfig screen for the
TOOLHEAD
,choose the following option and addPA6
on the last line (GPIO pins , if you want hotend fan enabled during boot), when ready press Q to quit & save :
Note
Because we are using Katapult as the bootloader, make sure you set the 8 KiB bootloader offset.
- Finally follow the instructions until the end :
-
Done! The Klipper firmware on both MCU has been updated.
-
Restart the printer :
sudo shutdown -r now
-
After the restart, you can uncomment the
[adxl345]
and[resonance_tester]
parts in your printer.cfg -
Enjoy mainline Klipper !
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!
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!