Hardware: Raspberry Pi 3B/3B+
Screen: Osoyoo 3.5″ SPI Touchscreen
System: Raspberry Pi OS Trixie (64-bit)
Reference: Original Tutorial (RPi4/5)
First boot with HDMI monitor, complete initial setup (username: pi), enable SSH.
sudo apt-get update sudo apt-get upgrade -y
sudo apt-get install unzip cmake -y cd ~ sudo wget https://osoyoo.com/driver/osoyoo35b.zip sudo unzip ./osoyoo35b.zip sudo cp osoyoo35b.dtbo /boot/overlays/
sudo apt-get install xserver-xorg-video-fbdev xserver-xorg-legacy -y
Package explanations:
xserver-xorg-video-fbdev – fbdev display driver (replaces fbturbo)xserver-xorg-legacy – Enables Xwrapper.config permissionssudo nano /boot/firmware/config.txt
#dtoverlay=vc4-kms-v3d #dtoverlay=vc4-fkms-v3d #display_auto_detect=1
# ========== SPI Screen Configuration ==========
gpu_mem=64
display_auto_detect=0
disable_fw_kms_setup=1
max_framebuffers=2
dtparam=spi=on
dtoverlay=osoyoo35b:speed=20000000
hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
hdmi_drive=2
display_rotate=2
hdmi_cvt MUST be 480 320, NOT 640 480.sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_wayland W1
do_wayland W1 switches from Wayland to X11. Trixie defaults to Wayland, but SPI screens do NOT support Wayland.sudo tee /etc/X11/Xwrapper.config > /dev/null << 'EOF' allowed_users=anybody needs_root_rights=yes EOF
needs_root_rights=yes is required because disabling KMS removes DRM device access.# Disable modesetting/kms config
sudo mv /usr/share/X11/xorg.conf.d/20-noglamor.conf \
/usr/share/X11/xorg.conf.d/20-noglamor.conf.bak 2>/dev/null
# Remove fbturbo config
sudo rm -f /usr/share/X11/xorg.conf.d/99-fbturbo.conf
sudo nano /etc/X11/xorg.conf.d/99-fbdev.conf
Add the following content:
Section "ServerLayout"
Identifier "SPI Layout"
Screen "SPI Screen"
EndSection
Section "Device"
Identifier "SPI Display"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
Option "ShadowFB" "on"
EndSection
Section "Monitor"
Identifier "SPI Monitor"
EndSection
Section "Screen"
Identifier "SPI Screen"
Monitor "SPI Monitor"
Device "SPI Display"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "480x320"
Virtual 480 320
EndSubSection
EndSection
ServerLayout forces X to ONLY use SPI screenfbdev "/dev/fb1": SPI screen is fb1 on RPi3 (fb0 is HDMI)ShadowFB "on": improves color rendering at 16-bit depthcat > ~/.bash_profile << 'EOF' export FRAMEBUFFER=/dev/fb1 startx 2> /tmp/xorg_errors EOF
sudo reboot
After successful reboot, connect via SSH:
sudo apt-get install xserver-xorg-input-evdev xinput-calibrator -y
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf \
/usr/share/X11/xorg.conf.d/45-evdev.conf
sudo tee /usr/share/X11/xorg.conf.d/99-calibration.conf > /dev/null << 'EOF'
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "241 3854 3885 240"
Option "SwapAxes" "1"
EndSection
EOF
sudo reboot
| Configuration | Original (RPi4/5) | RPi3 Modification |
|---|---|---|
| config.txt KMS | KMS enabled | MUST comment out dtoverlay=vc4-kms-v3d |
| config.txt gpu_mem | No setting | ADD gpu_mem=64 |
| X11 packages | Not needed | MUST install xserver-xorg-video-fbdev and xserver-xorg-legacy |
| Xwrapper.config | No modification | needs_root_rights=yes |
| 20-noglamor.conf | Keep | MUST disable |
| 99-fbturbo.conf | Keep (uses fb0) | MUST remove |
| 99-fbdev.conf | Not needed | MUST create with ServerLayout + fb1 |
| SPI screen device | /dev/fb0 | /dev/fb1 |
If screen is stuck at boot page or showing white screen, run these commands via SSH:
# Check X Server errors cat /tmp/xorg_errors # Check X log cat ~/.local/share/xorg/Xorg.0.log # Check framebuffer devices ls -l /dev/fb* dmesg | grep -i fb1 # Verify Xwrapper.config (no leading spaces!) cat /etc/X11/Xwrapper.config # Verify xserver-xorg-legacy is installed dpkg -l | grep xserver-xorg-legacy
Error: Cannot open /dev/tty0 (Permission denied)
Solution: Xwrapper.config is missing, has leading spaces, or xserver-xorg-legacy is not installed. Run:
sudo apt-get install xserver-xorg-legacy -y sudo tee /etc/X11/Xwrapper.config > /dev/null << 'EOF' allowed_users=anybody needs_root_rights=yes EOF
Switching VT failedError: no displays replace it or no screens found
Solution: KMS is disabled but LightDM is trying to use it. Make sure you are using CLI auto-login (B2) with startx, not LightDM. Run:
sudo raspi-config nonint do_boot_behaviour B2
Alt+F4 to close windows, Alt+drag to move windows. For a workaround, see the 640×480 virtual resolution tutorial.Error: White screen after reboot
Solution: Try power cycling (unplug and replug power). If still white, check:
# Check if fb1 exists ls -l /dev/fb* # Check if SPI overlay loaded dmesg | grep osoyoo # Verify config.txt changes cat /boot/firmware/config.txt | grep -E "(kms|spi|osoyoo)"
Error: Touch not working or inverted
Solution: Recalibrate touch screen:
DISPLAY=:0 xinput_calibrator
Then update /usr/share/X11/xorg.conf.d/99-calibration.conf with new values.
If you need to start over, run this one-click fix script:
#!/bin/bash # RPi3 SPI Screen Quick Fix # Install required packages sudo apt-get install xserver-xorg-video-fbdev xserver-xorg-legacy -y # Fix Xwrapper.config sudo tee /etc/X11/Xwrapper.config > /dev/null << 'EOF' allowed_users=anybody needs_root_rights=yes EOF # Disable conflicting configs sudo mv /usr/share/X11/xorg.conf.d/20-noglamor.conf \ /usr/share/X11/xorg.conf.d/20-noglamor.conf.bak 2>/dev/null sudo rm -f /usr/share/X11/xorg.conf.d/99-fbturbo.conf # Create fbdev config sudo mkdir -p /etc/X11/xorg.conf.d sudo tee /etc/X11/xorg.conf.d/99-fbdev.conf > /dev/null << 'EOF' Section "ServerLayout" Identifier "SPI Layout" Screen "SPI Screen" EndSection Section "Device" Identifier "SPI Display" Driver "fbdev" Option "fbdev" "/dev/fb1" Option "ShadowFB" "on" EndSection Section "Monitor" Identifier "SPI Monitor" EndSection Section "Screen" Identifier "SPI Screen" Monitor "SPI Monitor" Device "SPI Display" DefaultDepth 16 SubSection "Display" Depth 16 Modes "480x320" Virtual 480 320 EndSubSection EndSection EOF # Set boot behaviour sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_wayland W1 # Configure .bash_profile cat > ~/.bash_profile << 'EOF' export FRAMEBUFFER=/dev/fb1 startx 2> /tmp/xorg_errors EOF echo "Fix complete. Please reboot: sudo reboot"
Choose the tutorial that matches your Raspberry Pi model and OS version:
RPi 4/5 • 2025-10-01 and later
Bookworm / Trixie RPi 4/5
Bookworm / Trixie Setup Guide (RPi3-specific)
RPi 3 • Extra X11 config required • 2025-10-01 and later
Bookworm / Trixie RPi 3
RPi 3/4/5 • Before 2025-05-13
Bookworm RPi3/4/5
RPi 3/4 • LCD-show driver
Legacy RPi3/4
640×480 Virtual Resolution Guide
RPi 3 • x2fb scaling
Advanced • Trixie/Bookworm • 2025-10-01 and later
640×480 Virtual Resolution Guide
RPi 4/5 • x2fb scaling
Advanced • Trixie/Bookworm • 2025-10-01 and later
Not sure which to choose?
• Check your Pi model: cat /proc/device-tree/model
• Check your OS version: cat /etc/os-release
Need help or have feedback? Submit a ticket and our team will get back to you within 1-2 working
days. We appreciate your patience!
Working Time: 9 AM – 6 PM GMT+8 (Monday – Friday)
Contact Us: [email protected]
© 2026 Osoyoo | osoyoo.com
Last updated: 2026-02-10
DownLoad Url osoyoo.com