Raspberry Pi Usage Instructions
Notes:
- Ensure the host machine is powered off before installing the expansion board.
 - Avoid using the expansion board in humid or dusty environments.
 - When installing the screen, ensure not to plug or unplug the screen cable while powered on and pay attention to the orientation of the cable to avoid damage.
 - When installing the fan, pay attention to the fan's current and voltage specifications to avoid damage.
 - Please note that UART1 is already enabled by default and does not require configuration.
 - Please flash the latest image such as 
mainsailos, rather than upgrading the kernel. - All interfaces on the Raspberry Pi can be used!!!
 - Note: The system kernel version used on the Raspberry Pi must be greater than 
5.17.x. Execute the commanduname -rto check the kernel version. 
Download Link for Pre-installed TFTV2 System for Raspberry Pi
- 
System image compatible with Raspberry Pi Zero 2/Zero 2W/2B/3B/3B+/4B/CM4/5B.
 - 
This image comes pre-installed with klipper, moonraker, mainsail, fluidd, klipper-screen, etc.
 - 
Click the download link below:
 - 
Loading...
 
Installing G2T
- Reference is shown below:

 - Reference wiring:

 
Connecting Toolboard via Onboard RS232

- After flashing the latest system onto the Raspberry Pi, you need to edit the config.txt file on the boot partition.
 - Please note that UART1 is already enabled by default and does not require configuration within the system. UART3 requires the following steps:
 - Add the following line to config.txt:
 
dtoverlay=uart3
- If using UART1 for the ID, refer to the following:
 
[mcu] 
serial: /dev/ttyAMA0
baud: 250000
restart_method:command
- If using UART3 for the ID, refer to the following:
 
[mcu] 
serial: /dev/ttyAMA1
baud: 250000
restart_method:command
Using Onboard 5V FAN
- 
If you need the Raspberry Pi 40PIN to control the device, follow the installation instructions from the Klipper tutorial RPi Microcontroller

 
[mcu host]       
serial: /tmp/klipper_host_mcu 
[temperature_sensor Raspberry Pi]
sensor_type: temperature_host
[temperature_fan core_fan] 
pin: host:gpio12
max_power: 1.0
sensor_type: temperature_host   # Set to host main controller temperature
control:watermark                  # Control method
target_temp: 48                   # Upper host cooling fan activation temperature
min_temp: 0                     # Minimum temperature, errors will occur if below this
max_temp: 90                    # Maximum temperature, errors will occur if above this
off_below: 0.10
kick_start_time: 0.50
max_speed: 0.8                   # Maximum speed, 80% of full power
min_speed: 0.3                    # Minimum speed, 30% of full power
Screen Usage Instructions
- Github address FLY-TFT
 
1. Introduction
FLY-TFT-V2 is a TFT LCD screen based on ST7796, supporting both capacitive and resistive touch, with a resolution of 320x480, using the SPI interface.
2. System Installation
- Note: The system kernel version used on the Raspberry Pi must be greater than 
5.17.x. Execute the commanduname -rto check the kernel version. - Please flash the latest image such as 
mainsailos, rather than upgrading the kernel. - You need to install KlipperScreen manually.
 
- Use Raspberry Imager to install the latest MainsailOS:
- Download and install Raspberry Imager
 - Open Raspberry Imager
 - Click CHOOSE DEVICE
 - Select the corresponding model according to your device
 - Click CHOOSE OS
 - Select Other specific-purpose OS
 - Select 3D printing
 - Select Mainsail OS
 - Choose the latest version. If your setup supports a 64-bit system, choose rpi64
 - Click CHOOSE STORAGE
 - Select your storage device, such as an SD card
 - Click NEXT and wait for the installation to complete
 
 
4. Driver Installation
- 
Install FLY-TFT-V2 driver
git clone https://github.com/kluoyun/FLY-TFT.git
cd FLY-TFT
sudo chmod +x ./scripts/install.sh
./scripts/install.sh 
5. Usage
- Touch requires I2C support to be enabled. The corresponding configuration is 
dtparam=i2c_arm=on. 
- After installing the driver, add the overlay support 
dtoverlay=fly-tft-v2to the config.txt file. - Open 
/boot/config.txt(for the bookworm system, it's/boot/firmware/config.txt):sudo nano /boot/config.txt - Add the following configuration at the end of the file:
dtoverlay=fly-tft-v2 
- The default screen displays in landscape orientation at 90 degrees. If you need to rotate the screen, use the following configurations:
dtoverlay=fly-tft-v2,r90 # Same as default orientation, landscape
dtoverlay=fly-tft-v2,r270 # Landscape at 270 degrees, flipped
dtoverlay=fly-tft-v2,r0 # Portrait at 0 degrees, portrait
dtoverlay=fly-tft-v2,r180 # Portrait at 180 degrees, flipped- Only one configuration can be added, not multiple.
 - Under normal circumstances, the touch orientation of the TFT will automatically rotate to match the display orientation; there is no need to modify the touch configuration inside the system.
 
 
- 
After adding to the end of the file, execute the command
sudo rebootto restart the system.- Ensure the hardware connection is correct.
 - The driver is installed.
 - In the 
/boot/config.txt(bookworm system is/boot/firmware/config.txt) file, add the overlay supportdtoverlay=fly-tft-v2. - Some systems may have a default fb0 device, and FLY-TFT might be assigned to fb1. Modify the configuration file to enable the fb1 device.
 - Execute the command 
ls /dev/fb*to check the devices. If two devices, fb0 and fb1, appear, execute the following command to enable the fb1 device (default is fb0). - Execute the following command to modify the default configuration to use the fb1 device:
sudo sed -i 's/\/dev\/fb0/\/dev\/fb1/g' /etc/X11/xorg.conf.d/99-fbdev.conf 
 
6. Using KlipperScreen
- MainsailOS does not come with KlipperScreen installed by default; it needs to be installed manually.
 - Refer to KlipperScreen or use kiauh for installation.
 - If KlipperScreen is successfully installed and step 5 is completed correctly, the KlipperScreen interface should now be displayed.
 
7. All Available Configurations
- 
speedrequires parameter: Sets the maximum SPI clock frequency for the TFT in Hz, default is 96000000 (if severe screen artifacts occur, appropriately reduce this value). - 
Example:
dtoverlay=fly-tft-v2,speed=80000000 - 
r0/r90/r180/r270optional no parameter required: Sets the display and touch orientation of the TFT, default is 90 degrees, options are 0, 90, 180, 270 (only one configuration can be added). - 
Example:
dtoverlay=fly-tft-v2,r90ordtoverlay=fly-tft-v2,r180 - 
disable_touchno parameter required: Disables the touch functionality of the TFT, default is enabled. - 
Example:
dtoverlay=fly-tft-v2,disable_touch - 
invx,invyno parameter required: Sets the touch orientation of the TFT,invxis for X-axis inversion,invyis for Y-axis inversion. - 
Example:
dtoverlay=fly-tft-v2,invxordtoverlay=fly-tft-v2,invyordtoverlay=fly-tft-v2,invx,invy - 
swapxyno parameter required: Sets the touch orientation of the TFT, swapping the X and Y axes, i.e., landscape mode.- Example: 
dtoverlay=fly-tft-v2,swapxy 
 - Example: 
 
- Note: All parameters can be set simultaneously (optional parameters can only be set once), multiple parameters are separated by commas and must be on the same line.
 - Warning: Under normal circumstances, only the four parameters 
r0,r90,r180,r270should be used. Other parameters are only used in special cases, especiallyinvx,invy,swapxy. 
- Example: 
dtoverlay=fly-tft-v2,speed=80000000,r270 
Notes for Raspberry Pi Zero 2 and Zero 2W

- These notes are specifically for using the FLY-TFT screen with G2T.
 - Raspberry Pi Zero 2 and Zero 2W need to modify the default display device. Execute the code below directly to modify, otherwise the screen will not display.
 - Please note that after execution, a restart is required to take effect.
 
sudo sed -i 's/\/dev\/fb0/\/dev\/fb1/g' /etc/X11/xorg.conf.d/99-fbdev.conf
Screen Installation
