RPi3 + Osoyoo 3.5″ SPI Screen + Trixie/Bookworm Setup Guide

Hardware: Raspberry Pi 3B/3B+

Screen: Osoyoo 3.5″ SPI Touchscreen

System: Raspberry Pi OS Trixie (64-bit)

Reference: Original Tutorial (RPi4/5)

Note: The original tutorial works for RPi4/5. This guide includes RPi3-specific fixes required to make the SPI screen work on Raspberry Pi 3.

Table of Contents

1System Preparation

First boot with HDMI monitor, complete initial setup (username: pi), enable SSH.

sudo apt-get update
sudo apt-get upgrade -y

2Install SPI Screen Driver

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/

3Install Required X11 Packages (RPi3-specific)

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 permissions

4Edit config.txt

sudo nano /boot/firmware/config.txt

4a. Comment out these lines (add # at beginning):

#dtoverlay=vc4-kms-v3d
#dtoverlay=vc4-fkms-v3d
#display_auto_detect=1

4b. Add the following at the END of the file:

# ========== 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
Warning: hdmi_cvt MUST be 480 320, NOT 640 480.

5Switch to X11 and Set CLI Auto-login

sudo raspi-config nonint do_boot_behaviour B2
sudo raspi-config nonint do_wayland W1
CRITICAL: do_wayland W1 switches from Wayland to X11. Trixie defaults to Wayland, but SPI screens do NOT support Wayland.

6Fix X Server Permissions (RPi3-specific)

sudo tee /etc/X11/Xwrapper.config > /dev/null << 'EOF'
allowed_users=anybody
needs_root_rights=yes
EOF
Warning: Lines must have NO leading spaces. The needs_root_rights=yes is required because disabling KMS removes DRM device access.

7Disable Conflicting X11 Config Files

# 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

8Create X11 fbdev Configuration

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
Key points:
ServerLayout forces X to ONLY use SPI screen
fbdev "/dev/fb1": SPI screen is fb1 on RPi3 (fb0 is HDMI)
ShadowFB "on": improves color rendering at 16-bit depth

9Configure .bash_profile

cat > ~/.bash_profile << 'EOF' export FRAMEBUFFER=/dev/fb1 startx 2> /tmp/xorg_errors
EOF

10First Reboot

sudo reboot
Success: After reboot, the SPI screen should display the desktop. If the screen remains white, power off and restart the Pi.

11Configure Touch

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

RPi3 vs RPi4/5 Differences

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
Why these differences?
– RPi4/5: KMS enabled, SPI screen = fb0 (only fb), X auto-detects
– RPi3: KMS disabled, HDMI = fb0, SPI screen = fb1, X needs explicit config

Troubleshooting

Diagnostic Commands

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

Common Errors and Solutions

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
Error: Switching VT failed
Solution: You are running startx from SSH instead of physical tty1. This is normal when testing via SSH. The auto-login console will work correctly after reboot.

Error: 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
Error: Screen shows desktop but windows overflow
Solution: This is normal at 480×320 for some apps (like Control Centre). Use 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.

Quick Fix Script

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"

Known Limitations

Reference Tutorials

Choose the tutorial that matches your Raspberry Pi model and OS version:

Bookworm / Trixie Setup Guide

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

Bookworm Setup Guide (fbcp)

RPi 3/4/5 • Before 2025-05-13

Bookworm RPi3/4/5

Bullseye / Buster Setup Guide

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

Tech Support

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