Turbo Resin: open-source firmware for resin printers

Overview

Discord

Turbo Resin: open-source firmware for resin printers

Turbo Resin

Turbo Resin is an open-source firmware for chitu based controller board printers.

It currently supports:

  • Anycubic Photon Mono 4K

To add support for other printers, I need some help. If people could share photos of the circuit boards of various printers, that would be a great start!

This is the implementation of a firmware based on Reverse engineering the Anycubic Photon Mono 4K

Roadmap

Drivers:

  • Read the touch screen
  • Display on the touch screen
  • Use the LVGL UI library
  • Control the stepper motor
  • Read/write to external Flash
  • Read/write to external EEPROM
  • Drive the LCD panel (anti-aliasing support confirmed!)
  • Read from USB flash drive
  • Control the UV light
  • Z=0 detection

Printing features:

  • Better Z-Axis motion control for faster prints with fast deceleration
  • Z=0 calibration
  • Read .pwma files from USB flash drive
  • Support multiple exposure (like RERF but configurable)
  • Print algorithm
  • Support more file formats to support various slicers
  • Add support for other printers (help needed!)
  • Build-plate force feedback for speed optimization. Following the work of Jan Mrázek
  • Over-expose structural region of the print to add strength while letting edges be normally exposed

Flashing the firmware

As of now, there's no official distribution to flash the firmware via a USB stick. You'll need:

  • A programmer like JLink or ST-Link V2 ($11)
  • A 3mm hex screwdriver

Compiling the firmware

Prerequisites

Install the Rust toolchain. Follow instruction in the installation section of the Rust Embedded Book. For the target, use thumbv7em-none-eabihf.

Use the nightly toolchain for the project (otherwise you will have some no_std errors from memchr):

rustup override set nightly

Finally, export this environment variable set to the root of the project. It's for the lvgl dependency so it locates the lv_conf.h file.

export DEP_LV_CONFIG_PATH=`pwd`

Build

» make
cargo build --release
    Finished release [optimized + debuginfo] target(s) in 0.15s
cargo objdump --release -- -h | ./stuff/rom_stats.py
.vector_table  DATA     0.3K (0.1%)
.lvgl.text     TEXT   136.3K (53.3%)
.lvgl.rodata   DATA    27.8K (10.9%)
.libs.text     TEXT    39.0K (15.2%)
.libs.rodata   DATA     8.4K (3.3%)
.text          TEXT    13.1K (5.1%)
.rodata        DATA     2.8K (1.1%)
.data          DATA     0.1K (0.1%)
.bss           BSS     65.2K (67.9%)
.uninit        BSS      0.1K (0.1%)

Total ROM        227.8K (89.0%)
Total RAM         65.4K (68.1%)

Connect to the printer

First, connect your programmer to the SWD header on the board. Pinout is shown in Reverse engineering the Anycubic Photon Mono 4K Part1

Then, configure your programming interface

JLink

Run:

make -j2 start_jlink start_jlink_rtt

ST-Link or any OpenOCD compatible interface

  • Export this variable (or edit the Makefile) to select the stlink interface:
export OPENOCD_INTERFACE=stuff/stlink.cfg
  • Edit gdb/main.gdb and pick your JLink or OpenOCD interface:
source ./gdb/jlink.gdb
# source ./gdb/openocd.gdb
  • Start the OpenOCD server:
make start_opencd

cargo-flash

You can also use cargo-flash but I haven't tried.

Flash the new firmware

make run
» make run
cargo run --release -q
Reading symbols from target/thumbv7em-none-eabihf/release/app...
0xf4133022 in ?? ()
Loading section .vector_table, size 0x150 lma 0x8000000
Loading section .lvgl.text, size 0x22148 lma 0x8000150
Loading section .lvgl.rodata, size 0x6f2f lma 0x8022298
Loading section .libs.text, size 0x9bfa lma 0x80291c8
Loading section .libs.rodata, size 0x217f lma 0x8032dc4
Loading section .text, size 0x3439 lma 0x8034f43
Loading section .rodata, size 0xb14 lma 0x8038380
Loading section .data, size 0x7c lma 0x8038e94
Start address 0x08034f44, load size 233225
Transfer rate: 37959 KB/sec, 12275 bytes/write.
Resetting target
A debugging session is active.

        Inferior 1 [Remote target] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
[main●] turbo-resin »

Debugging

Use make attach, c, and ctrl+c to get a gdb instance connected to the device.

, dsc= , draw_ctx= ) at /Users/pafy/.cargo/git/checkouts/lvgl-rs-9408c72813c5388a/bf6ee92/lvgl-sys/vendor/lvgl/src/draw/sw/lv_draw_sw_letter.c:257 257 letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit); 1: x/5i $pc => 0x80193ca : ands r3, r1 0x80193cc : lsr.w r3, r3, r12 0x80193d0 : ands.w r3, r3, #255 ; 0xff 0x80193d4 : it ne 0x80193d6 : ldrbne.w r3, [r11, r3] (gdb)">
» make attach
arm-none-eabi-gdb -q -x gdb/main.gdb target/thumbv7em-none-eabihf/release/app
Reading symbols from target/thumbv7em-none-eabihf/release/app...
0xdeadbeee in ?? ()
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x080193ca in draw_letter_normal (map_p=0x80245fa 
          
            "", g=0x20017c88, pos=
           
            , dsc=
            
             , draw_ctx=
             
              ) at /Users/pafy/.cargo/git/checkouts/lvgl-rs-9408c72813c5388a/bf6ee92/lvgl-sys/vendor/lvgl/src/draw/sw/lv_draw_sw_letter.c:257
257                 letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
1: x/5i $pc
=> 0x80193ca 
              
               : ands r3, r1 0x80193cc 
               
                : lsr.w r3, r3, r12 0x80193d0 
                
                 : ands.w r3, r3, #255 ; 0xff 0x80193d4 
                 
                  : it ne 0x80193d6 
                  
                   : ldrbne.w r3, [r11, r3] (gdb) 
                  
                 
                
               
              
             
            
           
          

Alternatively, you can use VSCode's Run -> Start Debugging graphical debugger.

Restore the original firmware

If you are done with your changes, you can restore the original firmware with the following:

make restore_rom

License

Turbo Resin is licensed under the GPLv3

Comments
  • Support Photon Mono 2k

    Support Photon Mono 2k

    Since Photon Mono uses same board and chassis as PM4K and only difference is screen size I think supporting PM should be quite straightforward unless I am missing something.

    Compared to PM4K it has 130×80mm² (LxW) screen with 2560×1620 resolution.

    Photon Mono_V017.zip: 0.1.7 firmware TEST.pwmo: test print

    opened by gudvinr 3
  • `rust-toolchain.toml` has no effect on build (?)

    `rust-toolchain.toml` has no effect on build (?)

    It seems that rust-toolchain.toml has no effect on build: make build fails if the default toolchain is set to stable. But if renamed to rust-toolchain (without extension) then it works as expected: the specified nightly version gets downloaded and is used for the build.

    I don't know why that is since the doc says both file names should work.

    (env: Arch Linux, manually installed rustup)

    opened by fralalonde 8
  • General inquiry.

    General inquiry.

    Would it be possible to use a RasperryPi and it GPU to render images to the LCD screen? Use the Pi's serial port to control the printer mainboard? Incorporate this project into a well established project such as klipper and gain all the benefits associated with that?

    opened by mozzel 1
  • Board identification for Elegoo Mars 3

    Board identification for Elegoo Mars 3

    Mars3 owner reporting in here. I have opened up my machine and can verify it is indeed using this board:

    https://www.chitusystems.com/product/chitu-m20-motherboard-use-with-6-6-4k-mono-lcd-monochrome-with-chitusystems-for-elegoo-mars3/

    opened by koshisan 0
  • Board identification for the Phrozen Sonic Mini

    Board identification for the Phrozen Sonic Mini

    IMG_0379 IMG_0381

    I went ahead and connected to the serial port and didn't really get anything useful out of it. The entire board can be powered via the serial header, including the front LCD.

    UART1 init OK
    //Disk init fail!
    start
    start
    
     start_task
    magic_num:0xe21d000a  size:28960
    ###### Error!!!!!!File:..\3D\software\LCD_TFT\ilixxxx_api.cpp Func:GUI_DrawPicFromSPIFlash Line:626
    //Disk init fail!
    //Disk init fail!
    //############sd_mounted Error! cann't open file !
    
    opened by ihatemyisp 0
  • Board identification for the Elegoo Saturn

    Board identification for the Elegoo Saturn

    I don't see any version reported on the board (access is more difficult than the Mars 2, I may have missed it), but general aspect seems to confirm it's the one mentioned on Chitu shop : https://shop.chitusystems.com/product/elegoo-saturn-original-mother-with-chitu-systems-support-8-9-4k-monochrome-lcd/

    saturn-1 20220212_143857 20220212_144306

    opened by oelmekki 1
Owner
Nicolas Viennot
Discord: nviennot#6184 Telegram: @nviennot
Nicolas Viennot
A firmware for the Clueboard 66% Low Profile keyboard implemented in Rust.

Rust Firmware for Clueboard 66% Low Profile Keyboard A firmware for the Clueboard 66% Low Profile keyboard (also known as 66% hotswap) implemented in

Wesley Moore 10 Nov 2, 2022
69-key split mechanical keyboard (PCB, case, firmware)

ErgoNICE An open source 69-key column-staggered split mechanical keyboard with a rotary knob, extra connectors, a 3D printed case with "floating key"

null 12 Oct 1, 2022
MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine

MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box. For more information about features go to our documentation.

MeiliSearch 31.6k Dec 30, 2022
An open source virtual tabletop that is currently purely a concept.

An open source virtual tabletop that is currently purely a concept.

null 6 Oct 15, 2022
Blueboat is an open-source alternative to Cloudflare Workers. The monolithic engine for serverless web apps.

Blueboat Blueboat is an open-source alternative to Cloudflare Workers. Blueboat aims to be a developer-friendly, multi-tenant platform for serverless

Heyang Zhou 1.8k Jan 9, 2023
Download Apple's open source code from opensource.apple.com

Apple Open Source Downloader This repository defines a Rust crate and CLI program to automate the downloading of Apple's open source code from https:/

Gregory Szorc 6 Aug 19, 2022
Polydrive an experimental open source alternative to Google Drive

Polydrive is an experimental open source alternative to Google Drive. It allows users to synchronize their files on multiple devices.

null 3 Apr 20, 2022
A modern and open source twist to classic pastebin sites.

Turbine A modern and open-source twist to classic pastebin sites. What is this? Turbine originally started out as a simple pastebin idea so I could ha

Jay3332 4 Oct 1, 2022
Open Source Application Stack & PaaS

mycelia Open Source Application Stack & PaaS Installation cargo xtask build NOTE: We opted for cargo-xtask because Cargo build.rs is not supported for

Mycelia 3 Sep 6, 2023
A Rust client for the NOAA Weather Wire Service Open Interface.

nwws-oi A Rust client for the NOAA Weather Wire Service Open Interface. NWWS-OI is one of several platforms through which the National Weather Service

Will Glynn 3 Sep 15, 2022
OpenEMC: open embedded management controller

OpenEMC OpenEMC is an open-source firmware implementing an embedded management controller (EMC) on an STM32F1 microcontroller. It consists of a bootlo

Sebastian Urban 5 Dec 25, 2022
Source code for the Telegram channel @pixiv_daily

PixivDaily (Rust) This repository contains the source code of the program running the Telegram channel @pixiv_daily. Usage First, you'll need to clone

K4YT3X 5 Jun 23, 2022
ttasm is an assembler for assembling source code to TTVM executable.

ttasm is an assembler for assembling source code to TTVM executable.

maDeveloper 1 Nov 8, 2021
rFmt ---- Rust source code formatter

rfmt is a Rust source code formatter. Yes, there is already an official tool rustfmt from Rust Nursery.

baitu 25 Jan 11, 2022
Source code and documentation for our 'full stack on rust' meetup on 29-9-2022

Full stack on Rust This is the code and documentation repository for our 'Full stack on Rust' meetup on 29-9-2022. It includes step-by-step documentat

Baseflow 7 Oct 23, 2022
The source code of SSPŠ KB discord bot

Workshop bot This repository contains the source code of SSPŠ KB discord bot. Deploying This project is automatically built and deployed with docker,

SSPŠ KB 16 Mar 30, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
🚧 WIP: API client crate for Bambu Lab printers

Bambulab API ?? WORK IN PROGRESS ?? This crate is still in development and not ready for production use. Breaking changes may occur at any time. bambu

Mark Hähnel 6 Dec 11, 2023
H2O Open Source Kubernetes operator and a command-line tool to ease deployment (and undeployment) of H2O open-source machine learning platform H2O-3 to Kubernetes.

H2O Kubernetes Repository with official tools to aid the deployment of H2O Machine Learning platform to Kubernetes. There are two essential tools to b

H2O.ai 16 Nov 12, 2022
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Jason Shin 9 Apr 10, 2022