« Cohabitation écran Adafruit PiTFT 2.8" et HDMI » : différence entre les versions

De knowledge
Aller à la navigation Aller à la recherche
Page créée avec « = Configuration écran Adafruit PiTFT 2.8" et HDMI sur Raspberry Pi = == Contexte == Le Raspberry Pi gère plusieurs framebuffers : * <code>/dev/fb0</code> : sortie HDMI * <code>/dev/fb1</code> : écran PiTFT Par défaut, la console s'affiche sur <code>fb0</code>. L'installation du PiTFT peut rediriger la console vers <code>fb1</code>, rendant l'écran HDMI noir. == Installation du PiTFT == <syntaxhighlight lang="bash"> git clone https://github.com/adafruit/Ra... »
 
 
(3 versions intermédiaires par le même utilisateur non affichées)
Ligne 7 : Ligne 7 :


Par défaut, la console s'affiche sur <code>fb0</code>. L'installation du PiTFT peut rediriger la console vers <code>fb1</code>, rendant l'écran HDMI noir.
Par défaut, la console s'affiche sur <code>fb0</code>. L'installation du PiTFT peut rediriger la console vers <code>fb1</code>, rendant l'écran HDMI noir.
== Installation du PiTFT ==
<syntaxhighlight lang="bash">
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts
sudo python3 adafruit-pitft.py
</syntaxhighlight>
Choisir :
* Modèle : PiTFT 2.8"
* Orientation : selon montage
* Affichage : Console ou X11


== Méthode 1 : Console sur PiTFT ==
== Méthode 1 : Console sur PiTFT ==
<syntaxhighlight lang="ini">
Le fichier est soit dans /boot/config.txt soit dans /boot/firmware/config.txt C'est dans bookworm que le changement est apparu.<syntaxhighlight lang="bash">
# /boot/config.txt
# /boot/config.txt
# /boot/firmware/config.txt
dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20
dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20
</syntaxhighlight>
</syntaxhighlight>Même chose pour /boot/cmdline.txt<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="text">
# /boot/cmdline.txt
# /boot/cmdline.txt
# /boot/firmware/cmdline.txt
console=tty1 fbcon=map:10
console=tty1 fbcon=map:10
</syntaxhighlight>
</syntaxhighlight>


== Méthode 2 : Console sur HDMI ==
== Méthode 2 : Console sur HDMI ==
<syntaxhighlight lang="ini">
/boot/firmware/config.txt<syntaxhighlight lang="bash">
# /boot/config.txt
# /boot/firmware/config.txt
#dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20
dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20 # Comment to disable LCD
hdmi_force_hotplug=1
hdmi_force_hotplug=1
hdmi_group=2
hdmi_group=2         # 1=TV 2=Monitor
hdmi_mode=82
hdmi_mode=82         # Mode 82=1920x1080 60 Hz progressive 16=1024x768 à 60 Hz
</syntaxhighlight>
</syntaxhighlight>Et<syntaxhighlight lang="bash">
 
# /boot/firmware/cmdline.txt
<syntaxhighlight lang="text">
# /boot/cmdline.txt
console=tty1 fbcon=map:0
console=tty1 fbcon=map:0
</syntaxhighlight>
</syntaxhighlight>
Ligne 52 : Ligne 39 :
=== Script de mappage framebuffer ===
=== Script de mappage framebuffer ===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo nano /etc/init.d/fbmap.sh
sudo vi /etc/init.d/fbmap.sh
</syntaxhighlight>
</syntaxhighlight>


Ligne 59 : Ligne 46 :
#!/bin/bash
#!/bin/bash
con2fbmap 1 1  # tty1 → fb1
con2fbmap 1 1  # tty1 → fb1
con2fbmap 12 0 # tty12 → fb0
con2fbmap 2 0   # tty2 → fb0
</syntaxhighlight>
</syntaxhighlight>


Ligne 81 : Ligne 68 :
* Le mappage <code>fbcon=map:X</code> est global. Pour un contrôle fin, utiliser <code>con2fbmap</code>.
* Le mappage <code>fbcon=map:X</code> est global. Pour un contrôle fin, utiliser <code>con2fbmap</code>.
* X11 peut être configuré pour s'afficher sur un framebuffer spécifique via <code>xorg.conf</code>.
* X11 peut être configuré pour s'afficher sur un framebuffer spécifique via <code>xorg.conf</code>.
== Voir aussi ==
* [[Configuration réseau Raspberry Pi]]
* [[Provisioning QR code ASCII]]
* [[Compatibilité framebuffer et X11]]

Dernière version du 10 octobre 2025 à 21:35

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 :

  • tty1 sur PiTFT
  • tty12 sur 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 → PiTFT
  • Ctrl+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:X est global. Pour un contrôle fin, utiliser con2fbmap.
  • X11 peut être configuré pour s'afficher sur un framebuffer spécifique via xorg.conf.