===============================================================================
Hardware: Raspberry Pi 3B/3B+
Screen: Osoyoo 3.5″ SPI Touchscreen
System: 2025-12-04-raspios-trixie-arm64.img
Reference: https://osoyoo.com/2025/06/04/3-5spibookworm/
Note: The original tutorial works for RPi4/5. This guide includes RPi3-specific fixes.
===============================================================================
Step 1: System Preparation
===============================================================================
First boot with HDMI monitor, complete initial setup (username: pi), enable SSH.
sudo apt-get update
sudo apt-get upgrade -y
===============================================================================
Step 2: Install 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/
===============================================================================
Step 3: Edit config.txt
===============================================================================
sudo nano /boot/firmware/config.txt
— 3a. Find and COMMENT OUT the following lines (add # at the beginning) —
#dtoverlay=vc4-kms-v3d
#display_auto_detect=1
— 3b. 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
Save and exit (Ctrl+X, Y, Enter).
===============================================================================
Step 4: Switch to X11 and Set CLI Auto-login (CRITICAL!)
===============================================================================
sudo raspi-config nonint do_boot_behaviour B2
sudo raspi-config nonint do_wayland W1
NOTE: “do_wayland W1” switches from Wayland to X11.
Trixie defaults to Wayland, but SPI screens do NOT support Wayland.
This is the most critical step for RPi3.
===============================================================================
Step 5: Fix X Server Permissions (RPi3-specific fix)
===============================================================================
sudo nano /etc/X11/Xwrapper.config
Content MUST be:
allowed_users=anybody
needs_root_rights=yes
Save and exit.
===============================================================================
Step 6: Configure .bash_profile
===============================================================================
nano ~/.bash_profile
Add:
export FRAMEBUFFER=/dev/fb1
startx 2> /tmp/xorg_errors
Save and exit.
===============================================================================
Step 7: Configure 99-fbturbo
===============================================================================
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
If the file does not exist, create it. Content:
Section “Device”
Identifier “Allwinner A10/A13 FBDEV”
Driver “fbturbo”
Option “fbdev” “/dev/fb0”
Option “SwapbuffersWait” “true”
EndSection
Save and exit.
===============================================================================
Step 8: Create X11 fbdev Configuration (RPi3-specific, force fb1)
===============================================================================
sudo apt-get install xserver-xorg-video-fbdev -y
sudo nano /etc/X11/xorg.conf.d/99-fbdev.conf
Add:
Section “Device”
Identifier “SPI Display”
Driver “fbdev”
Option “fbdev” “/dev/fb1”
Option “ShadowFB” “off”
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 “480×320”
EndSubSection
EndSection
Save and exit.
===============================================================================
Step 9: First Reboot
===============================================================================
sudo reboot
After reboot, the SPI screen should display the desktop.
If the screen remains white, power off and restart the Pi.
===============================================================================
Step 10: Configure 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 nano /usr/share/X11/xorg.conf.d/99-calibration.conf
Add:
Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Option “Calibration” “241 3854 3885 240”
Option “SwapAxes” “1”
EndSection
Save and exit.
sudo reboot
DownLoad Url osoyoo.com