Fix for 7" Official Touchscreen Not Scaling Correctly on Cold Boot

125 views
Skip to first unread message

Danny Abdellatif

unread,
May 21, 2025, 6:54:54 AMMay 21
to PicoChess

Hi all,

I’ve noticed quite a few questions and troubleshooting threads about the official Raspberry Pi 7" touchscreen, so I wanted to share a fix for an issue I was encountering namely, incorrect resolution scaling after a cold boot.

Step 1: Basic Fix with xrandr
First, credit to RandyR for pointing out a simple and effective fix that works in most cases by fixing xrandr:

Edit your autostart file:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

And add this line:
@xrandr --output DSI-1 --primary --scale-from 1024x600

This forces the correct scaling on the DSI-1 display. It works well for most reboots, but I found that on cold boots the scaling would sometimes fail.

Step 2: Diagnosing the Cold Boot Issue
After some digging, I found the issue: if the power supply isn't completely stable at boot, the screen may not be recognized as a DSI display. As a result, it defaults to a generic framebuffer and skips the DSI-1 output entirely.

This is usually a power-on timing issue, especially common if you're powering the Pi from a battery or using lower-quality power supplies. The DSI display requires a stable 3.3V and a successful I²C handshake early in the boot sequence.

Step 3: Automatically Recovering with a Script

To address this, I created a script that checks whether the DSI display was correctly initialized — and restarts the display manager if it wasn’t.

Create the check script:
sudo nano /usr/local/bin/dsi-screen-check.sh

Paste in:
#!/bin/bash

# Wait for system to fully boot
sleep 10

# Check if the DSI display is attached
if ! grep -q "^DSI" /sys/class/drm/*/status 2>/dev/null; then
  echo "DSI screen not detected — restarting display stack..."

  # Try restarting common display managers
  sudo systemctl restart display-manager 2>/dev/null || \
  sudo systemctl restart lightdm 2>/dev/null || \
  sudo systemctl restart gdm 2>/dev/null || \
  sudo systemctl restart sddm 2>/dev/null
fi

Make it executable:
sudo chmod +x /usr/local/bin/dsi-screen-check.sh

Add a systemd service to run the script:
sudo nano /etc/systemd/system/dsi-screen-check.service

Insert:
[Unit]
Description=Check and reset DSI screen if not detected
After=multi-user.target

[Service]
ExecStart=/usr/local/bin/dsi-screen-check.sh
Type=oneshot

[Install]
WantedBy=multi-user.target

Enable the service:
sudo systemctl daemon-reexec
sudo systemctl enable dsi-screen-check.service

This service now runs at boot and will only restart the display manager if the DSI screen is not detected. When used together with the original xrandr fix, it ensures the display scales correctly even on setups that boot from battery or experience power irregularities.

Hope this helps someone avoid the same headaches! Let me know if you run into issues or have tweaks to improve it.

Kind regards,
Danny

Randy Reade

unread,
May 21, 2025, 8:27:47 AMMay 21
to pico...@googlegroups.com
That's great info, Danny. Thanks for sharing. Too bad we can't pin posts on here.

Randy

--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/808c4f95-83bf-45a7-87ee-ad08f9d4f731n%40googlegroups.com.

Wee MacGregor

unread,
Jun 30, 2025, 9:51:26 AMJun 30
to PicoChess
20250630_143856.jpg20250630_144031.jpg

I have an issue with the display size and your fix using a 7" official display. The fist photo is a Pi4 and the second a Pi5. The Pi5 has smaller text, buttons and tables. Both are identical setups using Randys image.

Any ideas?

Many thanks,

Andrew
Reply all
Reply to author
Forward
0 new messages