Cohabitation écran Adafruit PiTFT 2.8" et HDMI
Aller à la navigation
Aller à la recherche
Configuration écran Adafruit PiTFT 2.8" et HDMI sur Raspberry Pi
Contexte
Le Raspberry Pi gère plusieurs framebuffers :
/dev/fb0: sortie HDMI/dev/fb1: écran PiTFT
Par défaut, la console s'affiche sur fb0. L'installation du PiTFT peut rediriger la console vers fb1, rendant l'écran HDMI noir.
Méthode 1 : Console sur PiTFT
Le fichier est soit dans /boot/config.txt soit dans /boot/firmware/config.txt C'est dans bookworm que le changement est apparu.
# /boot/config.txt
# /boot/firmware/config.txt
dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20
Même chose pour /boot/cmdline.txt
# /boot/cmdline.txt
# /boot/firmware/cmdline.txt
console=tty1 fbcon=map:10
Méthode 2 : Console sur HDMI
/boot/firmware/config.txt
# /boot/firmware/config.txt
dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20 # Comment to disable LCD
hdmi_force_hotplug=1
hdmi_group=2 # 1=TV 2=Monitor
hdmi_mode=82 # Mode 82=1920x1080 60 Hz progressive 16=1024x768 à 60 Hz
Et
# /boot/firmware/cmdline.txt
console=tty1 fbcon=map:0
Méthode 3 : Multi-console (switch avec Ctrl+Alt+Fn)
Permet d'afficher :
tty1sur PiTFTtty12sur HDMI
Script de mappage framebuffer
sudo vi /etc/init.d/fbmap.sh
Contenu :
#!/bin/bash
con2fbmap 1 1 # tty1 → fb1
con2fbmap 2 0 # tty2 → fb0
Activation :
sudo chmod +x /etc/init.d/fbmap.sh
sudo update-rc.d fbmap.sh defaults
Bascule clavier
Ctrl+Alt+F1→ PiTFTCtrl+Alt+F12→ HDMI
Test rapide
cp /dev/random /dev/fb0 # bruit sur HDMI
cp /dev/random /dev/fb1 # bruit sur PiTFT
Notes
- Le mappage
fbcon=map:Xest global. Pour un contrôle fin, utilisercon2fbmap. - X11 peut être configuré pour s'afficher sur un framebuffer spécifique via
xorg.conf.