Skip to content

farshid3003/Snapmaker2-Controller-klipper

 
 

Repository files navigation

Snapmaker 2.0 → Klipper (R&D Port)

Status: Experimental scaffold. This repo is a starting point for a true Klipper port targeting the Snapmaker 2.0 controller (GD32F105 series). It does not contain vendor code and is intentionally minimal so you can develop the port cleanly.

What’s here

  • firmware/mcu: A new MCU target scaffold for Klipper-like firmware bring‑up on GD32F105.
  • firmware/mcu/boards/snapmaker2: Board definition stubs and pinmaps.
  • host/printer_cfg: Starter printer.cfg fragments for host side Klipper.
  • docs: Bring‑up notes, CAN reverse‑engineering log, and milestones.
  • tools / scripts: Helper scripts for flashing, logging, and probing.
  • CI: A tiny build check workflow.

High‑level milestones

  1. MCU bring‑up: clocks, systick, GPIO, basic timers, UART/USB CDC.
  2. Motion core: step/dir/timer ISR; endstop sampling; soft PWM.
  3. Thermals: ADC readout for thermistors; PID for hotend/bed; safety.
  4. Storage/EEPROM (optional): emulate if needed.
  5. Fieldbus: CAN driver + Snapmaker toolhead protocol shim (print head first).
  6. Homing: endstops; axis map; kinematics validation.
  7. Host link: serial/USB framing compatible with Klipper host.
  8. Regression: print-path validation; resonance; input shaper integration.

Legal / licensing

  • This repo contains original stubs and notes only; no Snapmaker, Marlin, or Klipper code is copied.
  • You must ensure compatibility with GPL/AGPL obligations of projects you integrate later.

Quick start (dev)

# 1) Setup toolchain (arm-none-eabi-gcc, python3)
# 2) Configure target (generates build/.config)
python3 scripts/menuconfig.py

# 3) Build
make -C firmware/mcu

# 4) Flash (example with ST-Link)
scripts/flash_stlink.sh build/gd32f105/snap2-klipper.elf

Safe testing via emulation

If you would rather not flash the Snapmaker controller yet, build the firmware with the emulation flag and run it under the xPack QEMU Arm stm32vldiscovery machine. The helper script will launch the emulator and stream UART output to your terminal:

make -C firmware/mcu clean
make -C firmware/mcu EMULATOR=stm32vl
scripts/run_qemu.sh

See docs/EMULATION.md for full installation and troubleshooting notes.

A350T notes (assumptions)

  • MCU: GD32F105 series (Cortex‑M3). We assume a 72 MHz system clock initially.
  • LED pin: provisionally PC13 (common on F1/F105 boards). If your board differs, update platform_led_set() and CRH setup in clock.c.
  • UART debug: assumed USART1 on PA9/PA10 at 115200. If you see no logs, try USART2 (PA2/PA3) or confirm with probing.

Flash & test

openocd -f openocd/a350t.cfg -c "program build/gd32f105/snap2-klipper.elf verify reset exit"
# Connect USB‑TTL to PA9 (TX out) and GND; 115200 8N1; expect boot logs and dots.

About

Snapmaker2-Controller is the firmware for Snapmaker 2.0 3-in-1 3D Printers with Klipper.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 57.9%
  • C++ 39.4%
  • Python 0.9%
  • Assembly 0.6%
  • Shell 0.4%
  • Makefile 0.4%
  • Other 0.4%