Skip to main content

USB Bridge CAN Firmware Compilation and Flashing

Confirmation Before Use

CANHAT Discontinued
  • The Gemini V2 does not have an onboard CAN transceiver chip and requires a CANHAT to use the USB bridge CAN function.
  • The CANHAT has been discontinued. If you do not have a CANHAT module, please do not configure the CAN bridge according to this page.
  • When using a CAN tool board, please confirm that the host can0 rate, the Gemini V2 bridge firmware rate, and the CAN tool board firmware rate are consistent.

Install CANHAT and Check DIP Switches

Power Off Required

Before starting, completely shut down the printer and disconnect the power supply. Do not plug or unplug wiring harnesses, arrange interface wires, or touch terminals while the device is powered on.

  • The red pin header of the CANHAT corresponds to the red female header on the Gemini V2, and the black pin header corresponds to the black female header. Incorrect orientation may damage the device.
  • After installing the CANHAT, turn on DIP switches 1, 2, 5, and 6, and keep all other switches off.
Loading...
Loading...

CAN Wiring

Power Off Required

Before starting, completely shut down the printer and disconnect the power supply. Do not plug or unplug wiring harnesses, arrange interface wires, or touch terminals while the device is powered on.

  • When connecting the CANHAT to the CAN tool board, verify the CANH, CANL, and power supply positive and negative terminals according to the tool board documentation.
  • Termination resistors should be set at both ends of the CAN bus according to actual equipment requirements.
  • If you need to flash the firmware of the CAN tool board, please refer to the corresponding tool board product documentation.
Loading...

SSH Connection to the Host

Caution
  • The Gemini V2 host must be connected via SSH before compiling the firmware.
  • It is recommended to connect via WiFi or Ethernet cable over SSH before compiling the firmware.
  • First, please: Connect to Gemini V2 Host SSH

Compile the USB Bridge CAN Firmware

Brief Guide to Firmware Compilation

Notes

  • Network: Ensure the host (Raspberry Pi, etc.) is connected to the internet.
  • Login Method: Must log in via SSH over the network; serial port access is disabled.
  • Input Method: Keep the keyboard in English half-width mode.

SSH Login and User Switching

Use tools like MobaXterm, PuTTY, etc., to SSH into the host.

Switch User:

  • Standard System (Official Raspberry Pi system, etc.)
    Do not use root; switch to a regular user:
    su <username>
  • FLY Host System (FlyOS-FAST system)
    Only supports login as root user (password: mellow)

Firmware Compilation Operation Guide

In the Klipper firmware configuration interface, only keyboard operations are supported; the mouse cannot be used.

KeyFunction
↑ / ↓Move cursor up/down to select menu items
Enter / SpaceConfirm selection, check options, or enter submenus
ESCReturn to the previous menu
QExit the configuration interface
YIf prompted when exiting, press Y to save the configuration

Starting Firmware Compilation

Below is an introduction on how to compile the firmware:

  1. Connect via SSH, enter the following command, and press Enter:

    cd ~/klipper && rm -rf ~/klipper/.config && rm -rf ~/klipper/out && make menuconfig

    Here, rm -rf ~/klipper/.config && rm -rf ~/klipper/out is used to clear previous compilation configurations and firmware; make menuconfig is used to open the Klipper firmware configuration interface.

  2. Follow the order below to set each item one by one, completing each before moving on to the next.

    1启用 Enable extra low-level configuration options
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    2Micro-controller Architecture 选择 STMicroelectronics STM32
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    3Processor model 选择 STM32F405
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    4Bootloader offset 选择 32KiB bootloader
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    5Clock Reference 选择 8 MHz crystal
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    6Communication interface 选择 USB to CAN bus bridge (USB on PA11/PA12)
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    7CAN bus interface 选择 CAN bus (on PB8/PB9)
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    8USB ids 保持默认,无需进入
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    9CAN bus speed 设置为 1000000
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    10启用 Optimize stepper code for 'step on both edges'
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    11GPIO pins to set at micro-controller startup 保持为空
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    12GPIO state at micro-controller startup 选择 Not set

    此项是 FLYOS-Klipper 功能。通常保持 Not set;如需设置全部 GPIO 的启动状态,请先阅读 GPIO 启动状态使用说明

    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    13Q 键退出配置界面
    (Top)
    Klipper Firmware Configuration
    [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32) --->
    Processor model (STM32F405) --->
    Bootloader offset (32KiB bootloader) --->
    Clock Reference (8 MHz crystal) --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) --->
    CAN bus interface (CAN bus (on PB8/PB9)) --->
    USB ids --->
    (1000000) CAN bus speed
    [*] Optimize stepper code for 'step on both edges'
    () GPIO pins to set at micro-controller startup
    GPIO state at micro-controller startup (Not set) --->
    14出现 Save configuration 时按 Y 保存配置
    Quit
    Save configuration?
    (Y)es(N)o(C)ancel
  3. After completing the last two steps above, press Q to exit the configuration interface, then press Y to save the configuration.

  4. Return to the command line and enter the following command, then press Enter to start compiling:

    make -j4
    root@flyos-11e5f8 ~/klipper # make -j4
    Compiling out/src/generic/canserial.o
    Compiling out/src/../lib/fast-hash/fasthash.o
    Compiling out/src/stm32/can.o
    Compiling out/src/stm32/chipid.o
    Compiling out/src/generic/usb_canbus.o
    Compiling out/src/stm32/hard_pwm.o
    Compiling out/src/stm32/sdio.o
    Preprocessing out/src/generic/armcm_link.ld
    Building out/compile_time_request.o
    Version: XXXX
    Linking out/klipper.elf
    Creating bin file out/klipper.bin

    终端末尾出现 Linking out/klipper.elf Creating bin file out/klipper.bin,即表示编译成功。 实际编译时,部分 Compiling 行和 Version 会随 Klipper 与系统版本变化。

Loading...

Flash Firmware via TF Card

Power Off Required

Before starting, completely shut down the printer and disconnect the power supply. Do not plug or unplug wiring harnesses, arrange interface wires, or touch terminals while the device is powered on.

Flashing Instructions
  • The Gemini V2 lower computer firmware is flashed using a TF card.
  • After compilation is complete, download klipper.bin to the TF card and rename it to firmware.bin.
  • After powering on and completing the flash, the firmware.bin file on the TF card will disappear and a FLY.CUR file will appear, indicating a successful flash.

Preparation

  • Before starting to flash the firmware, please connect via SSH over the network
  • Off-brand memory cards may cause flashing to fail. Please use the recommended memory cards below to update the firmware
  • You need to prepare a TF card with a capacity not exceeding 32G. It is recommended that the transfer speed of the TF card be Class 10 or above. It is recommended to use TF cards from brands such as SanDisk

Download Firmware

  1. Use the previously prepared TF card

  2. Format using SDFormatter

    Loading...
  3. Use MobaXterm_Personal, find the klipper folder in the left file directory, select it, then find out and open it

    Caution
    • Notes for Ordinary Systems
      • This applies to ordinary host computer systems such as Raspberry Pi, FLY Pi, etc.
      • The compiled firmware is located in the /home/<your host computer username>/klipper/out/ directory
      Loading...
  4. Download klipper.bin to the TF card, and rename it to firmware.bin

    firmware.bin
    Loading...
Windows File Extension Display

Windows may hide file extensions by default, which can easily result in the file being saved as firmware.bin.txt or firmware.bin.bin. Before renaming the firmware, enable extension display in File Explorer:

  1. Open any folder.
  2. Click on View at the top.
  3. Check the File name extensions box.
  4. When renaming the file, make sure the complete file name is firmware.bin.
  1. Power off the motherboard, insert the TF card into the motherboard
  2. Power on the motherboard, wait for 10 seconds
  3. Remove the TF card, insert it into the computer. If firmware.bin in the SD card has disappeared and FLY.CUR appears, the flashing is successful
    Loading...

Search for CAN UUID After Flashing

After the firmware flash is complete and the Gemini V2 has been powered on again, please do not connect the CAN tool board yet. First, search for the CAN UUID of the Gemini V2 motherboard itself. After confirming the motherboard UUID, connect and flash the firmware of the corresponding CAN tool board.

View the CANBus UUID Retrieval Method

Loading...