
Background of the Issue
Initial State: After re-flashing the Raspberry Pi system, the Touch Display 2 only shows the cursor and does not display the full desktop. During this process, a segmentation fault in libc-bin caused system instability.
Prerequisites:
Core Hardware List for Raspberry Pi Project
1. Raspberry Pi 5
▪ Model: Raspberry Pi (16GB)
2. Official Touch Display 2
▪ 7-inch DSI Touchscreen
▪ Resolution: 720×1280
▪ Connection Method: DSI ribbon cable input device
3. Logitech K580 Bluetooth Keyboard and Wired Mouse
▪ Model: Logi K580 Keyboard
4. SD Card
▪ Used for installing the operating system, I bought the official Raspberry Pi 64G, A2, with a card case and card reader. ▪ Formatted to FAT32 (MS-DOS) file system
5. Router + Gigabit Ethernet Cable
▪ Model: Any home model, it's best to connect via Ethernet for the first boot for stability and ease of SSH access.
🏆
Q1: What should I do if the Raspberry Pi Display 2 Touch does not load the graphical interface properly?
System Reinstallation and Basic Configuration
Diagnosing the Initial Issue
• Use nmap to scan the network and discover the Raspberry Pi device; please consult the AI assistant for more precise code.
sudo nmap -sn your_router_IP/**
• Attempt SSH connection for diagnosis
• Execute ps aux | grep X to find that the X service is not running
System Reinstallation
• Ensure not to use the 64-bit system; switch to the more stable 32-bit version
• Use the Raspberry Pi Imager tool to flash Raspberry Pi OS (32-bit)
• Configure to enable SSH before flashing, set the username to “your preference” (this is crucial!!!)
• Use MS-DOS (FAT) file system format
Initial Connection and Configuration
• Connect to the newly installed system via SSH (ssh “your_username”@”your_Raspberry_Pi_IP”)
• Resolve SSH host key change warning (ssh-keygen -R “your_Raspberry_Pi_IP”)
System Selection and Stability
• Experience: The 32-bit system is more stable than the 64-bit system, especially for touchscreen display support
• Best Practice: Prefer the 32-bit system when large memory support is not needed
Choosing the 32-bit operating system, I reinstalled the 64-bit system many times without success; it always only showed the cursor, which was strange and may relate to my settings. After flashing the system, in the config.txt file, set the following:
Configuration File Location
• Experience: The configuration file location has moved from /boot/config.txt to /boot/firmware/config.txt
• Best Practice: Be aware of potential changes in configuration file locations due to system upgrades
After flashing the system, we made the following key settings in the /boot/firmware/config.txt file:
Initial Display Driver Configuration
Enable DSI Touchscreen Support
dtoverlay=vc4-kms-dsi-7inch
This is the essential configuration required to enable the Raspberry Pi Touch Display 2, informing the system that a 7-inch touchscreen is connected via the DSI interface.
Enable DRM VC4 V3D Driver
dtoverlay=vc4-kms-v3dmax_framebuffers=2
These settings enable the GPU hardware acceleration feature of the Raspberry Pi and set the maximum number of frame buffers to support multi-display configurations.
⚽
Q2: How can I use an existing Bluetooth keyboard and mouse if I don’t have wired devices?
Bluetooth Keyboard Configuration
Enable Bluetooth Service
• Install necessary Bluetooth packages: sudo apt install bluetooth pi-bluetooth bluez
• Start and enable the Bluetooth service: sudo systemctl enable bluetooth
• Handle locale warnings – this can be ignored as it does not significantly affect functionality
Bluetooth Keyboard Search and Pairing
• Use bluetoothctl tool to manage Bluetooth devices
• Start scanning: scan on
• Discover my personal device – Logitech K580 Keyboard
• Attempt pairing process: pair MAC_address
Lessons Learned and Best Practices
The configured system for Raspberry Pi 5 is Raspberry Pi OS
The graphical interface uses the Wayland server (default setting in the Bookworm system)
Wayland vs X11
• Experience: On the latest Raspberry Pi OS, Wayland is the default display server, requiring different configuration methods
• Best Practice: Use wlr-randr instead of xrandr to configure displays under Wayland
⚽
Q3: The Raspberry Pi system loads in portrait mode; how can I rotate it?
Display Configuration
Enable Desktop Environment
• Configure the system to automatically start in the desktop environment
• Install and configure the display manager lightdm
• Set the touchscreen dtoverlay parameter (dtoverlay=vc4-kms-dsi-7inch)
Screen Rotation Challenges
• Attempt to modify the rotation parameter via /boot/firmware/config.txt
• Multiple attempts with different dtoverlay parameters:
dtoverlay=vc4-kms-dsi-7inch,rotation=1/2/3display_lcd_rotate=1
• Use dmesg | grep -i dsi to confirm the display model (****-dsi)
Screen Rotation in Wayland Environment
• Discover that the system uses Wayland instead of X11, making standard X11 methods inapplicable
• Use DISPLAY=:0 xrandr to check the current display status
• Use wlr-randr to get the correct output name (DSI-2)
• Successfully rotate the screen using wlr-randr –output DSI-2 –transform 90
• Create an autostart script to ensure settings persist:
~/.config/autostart/rotate-screen.desktop
Find the corresponding device list, configure it, and consult the large model in a timely manner
- Display Configuration
• Experience: Correctly identifying the display model and using the corresponding dtoverlay is necessary
• Best Practice: Use dmesg | grep -i dsi to determine the display model, then select the corresponding configuration
wlr-randr
wlr-randr --output DSI-2 --transform 90
Autostart Script
• Experience: A temporary solution can be achieved through an autostart script for persistence
• Best Practice: Add successful commands to the .desktop file in the ~/.config/autostart/ directory
This experience indicates that for modern Raspberry Pi systems using Wayland, some display configurations may need to be implemented through dedicated Wayland tools after the user session starts, rather than solely relying on traditional config.txt configurations.
Finally, the touch is usable, and it has been successfully paired.
Practical Application Scenarios
The Raspberry Pi Touch Display 2 can be used with Raspberry Pi for:
1. Home Automation Control Panel
▪ Smart Home Control Center
▪ Weather and Calendar Information Display
2. Embedded System Interface
▪ Industrial Control Panel
▪ Information Kiosk
3. Portable Development Workstation
▪ Code Editing
▪ System Monitoring
4. Multimedia Control Center
▪ Music Player
▪ Photo Browsing
5. Educational Projects
▪ Interactive Learning Tools
▪ Programming Teaching Devices
Advanced Configuration Tips
• Custom Boot Screen: Replace the boot screen to personalize your device
• Power Management: Configure automatic display shutdown to save energy
• Touch Gestures: Add custom touch gestures to enhance interaction
• Screen Sharing: Configure VNC server for remote access
• Performance Optimization: Adjust GPU memory allocation to optimize display performance
The Raspberry Pi Touch Display 2 is a powerful addition to the Raspberry Pi ecosystem. Although the initial configuration may present some challenges, once set up correctly, it will provide an excellent interactive display solution for various projects.
The pin issue is also a concern, especially when the AI hat accelerator PCIe occupies all the original pins. More on that next time.
