Skip to content

Flash Motherboard Firmware

Motherboard firmware needs to be updated to support the latest version of Klipper.
The process explains how to flash the Klipper Firmware and the Katapult Bootloader (useful for being able to update future Klipper firmwares later).

Prerequisites



Note

You can skip this step if you have already installed the utility.

  • Unzip STM32_ST-LINK_Utility_v4.6.0.zip file and run STM32 ST-LINK Utility v4.6.0.exe installer.

  • Click on Next button:

  • Click on Yes button:

  • Click on Next button:

  • Click on Finish button:

  • A new window appears, click on Next button to install required drivers:

  • Then, click on Finish button:


  • Make sure your printer is turned off.

  • Connect motherboard JTAG pins to ST-LINK V2 Programmer:

    Warning

    Not all STM32 Programmers (especially clones) have the same pin positions.
    Make sure to match the pins on the SMT32 Programmer with those on the motherboard.

  • Connect the ST-LINK V2 Programmer to a USB port on your computer.

  • Start STM32 ST-LINK Utility and click on Connect to target button:

    If you have this message, it means that the Dupont cables are not connected to the right places, check your connections:

    If you have this message, it means that the drivers for STM32 Programmer are not installed:

    If you have this message, it means that the memory is protected against read out:

    Click on TargetOption Bytes and set Read Out Protection parameter to Disabled, and then click Apply button:

  • If the connection is correct, you should get this:

Backup Motherboard Firmware


First of all, it's imperative to backup your motherboard's stock firmware in case you want to restore it.

  • When ST-LINK V2 Programmer is connected to motherboard, make sure the Size is set to 0x80000

  • Then, click on FileSave file as...:

  • And save the file on your computer with the name you want and the extension .bin. The file size should be 512 KB, which is a full dump.

Note

If needed, you can download a full dump of FLSUN S1 (not Pro) here: motherboard_fw_stock.bin

Flash Bootloader and Klipper Firmware


  • When ST-LINK V2 Programmer is connected to motherboard, click on FileOpen file... and select motherboard_fw.bin firmware file:

  • Then, click on Program verify button:

  • Make sure this information are the same, click Start button and wait for the firmware to be written:

  • If the firmware is written successfully, the following message will appear:

  • You can now disconnect from target by clicking on Disconnect button:

  • You can now unplug the ST-LINK V2 Programmer from your computer and remove Dupont cables from motherboard.

  • Next, follow Insert microSD Card with FLSUN OS in Core Board section.

Note

If you want to go back to stock OS you need to reflash your backup firmware.

Update Klipper Firmware


Once the firmware is flashed, you will be able to update your motherboard MCU with a future Klipper Firmware.

Note

MCUs have limited write cycles (about 10K cycles for a STM32 chip). Updating the firmware with each Klipper release could shorten the life of your MCU!

When is it necessary to update Klipper firmware?
Every time Klipper mentions to update the MCU at startup, no more.

  • Connect to printer over SSH (see SSH Connection section).

  • In the SSH command prompt window, enter the following command to start Easy Installer:

    SSH Command Prompt
    easy-installer
    

  • Enter 3 for Extras menu → 2 for Update Motherboard MCU firmwareEnter to confirm your choice:

  • Klipper Firmware will be builded and flashed.

Extras


You can build your own Katapult Bootloader and Klipper Firmware and combine them into a ready-to-flash file.

  • Connect to printer over SSH (see SSH Connection section).

  • In the SSH command prompt window, enter the following commands (one at a time) to configure Katapult Bootloader:

    SSH Command Prompt
    cd ~/katapult && git reset --hard && git pull
    
    SSH Command Prompt
    make menuconfig
    

  • Move on the menu with the and keys of your keyboard and validate the selected item with the Enter key and select these settings:

  • Then on your keyboard press the Q key then Y to save configuration.

  • Enter the following command to compile Katapult Bootloader:

    SSH Command Prompt
    make clean && make
    
  • When it's done, enter the following commands (one at a time) to configure Klipper Firmware:

    SSH Command Prompt
    cd ~/klipper && git reset --hard && git pull
    
    SSH Command Prompt
    make menuconfig
    

  • Move on the menu with the and keys of your keyboard and validate the selected item with the Enter key and select these settings:

  • Then on your keyboard press the Q key then Y to save configuration.

  • Enter the following command to compile Klipper Firmware:

    SSH Command Prompt
    make clean && make
    
  • When it's done, enter the following command to combine Katapult Bootloader and Klipper Firmware into a ready-to-flash file:

    SSH Command Prompt
    ./flsun-os/system/merge_firmware.py
    
  • Get the firmware named motherboard_fw.bin in /home/pi directory (on the left panel of MobaXterm, right click on the file and select Download).


If you like my work, don't hesitate to support me by paying me a 🍺 or a ☕. Thank you 🙂