Verified Commit 84a46aa2 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add latest state of research for display and touch

parent 6bacd105
Loading
Loading
Loading
Loading
+39 −4
Original line number Diff line number Diff line
@@ -130,24 +130,59 @@ Then, connect the cables to the Pi as described in this chart:
### Display

1. Connect the display by placing it on the GPIO header
2. Add the following line to `/boot/firmware/config.txt`
2. Download the [`waveshare35a-overlay.dtb` Device Tree Overlay](https://github.com/waveshareteam/LCD-show/raw/refs/heads/master/waveshare35a-overlay.dtb) and save it as `/boot/firmware/overlays/waveshare35a.dtbo`
3. Add the following lines to `/boot/firmware/config.txt`

    ```ini
    dtoverlay=fbtft,spi0-0,ili9486,width=320,height=480,regwidth=16,reset_pin=25,dc_pin=24,rotate=270
    dtparam=i2c_arm=on
    dtoverlay=waveshare35a
    ```

3. Add `fbcon=map:2` at the end of the line to `/boot/firmware/cmdline.txt`
4. Add `fbcon=map:2` at the end of the line to `/boot/firmware/cmdline.txt`
    - This will tell the framebuffer console (fbcon) to map all its terminals to `/dev/fb2` (which doesn't exist), i.e. don't show a Linux TTY on the display

<details>
<summary>Links</summary>

- [🌟 Python pygame fails to output to /dev/fb1 on a Raspberry Pi + TFT screen](https://stackoverflow.com/a/54986161/)
- [🌟 Setting Up a TFT Touchscreen on a Raspberry Pi with a fbtft Linux Driver](https://chrizog.com/rpi-linux-fbtft-touchscreen-setup)
- [Raspberry Pi Forum post mentioning the line to include in the config (German)](https://forum-raspberrypi.de/forum/thread/55290-displays-mit-spi-anschluss-unter-raspberry-pi-os-bullseye-bookworm/)
- [Python pygame fails to output to /dev/fb1 on a Raspberry Pi + TFT screen](https://stackoverflow.com/a/54986161/)
- [Device tree overlays README](https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README)
- [RB-TFT3.5 Manual (German)](https://joy-it.net/files/files/Produkte/RB-TFT3.5/RB-TFT-Anleitung_04082020.pdf)
- [Frame Buffer Kernel Docs](https://www.kernel.org/doc/html/latest/fb/fbcon.html)
- [FBTFT docs](https://learn.watterott.com/de/hats/rpi-display/fbtft-install/) (they mention something about the touchscreen, connection speed, latency etc.)
- [Issue with XPT2046/ADS7846 touchscreen on RPi3](https://forums.raspberrypi.com/viewtopic.php?t=173993)

</details>

<details>
<summary>How to check if touch is working</summary>

```
sudo apt install evtest
sudo evtest
```

Whenever a touch event is received, this should print something to the command line.
</details>

<details>
<summary>Access display without Waveshare Device Tree Overlay</summary>

If you only need to display something, the built-in `fbtft` Device Tree Overlay works with this command:

```ini
dtoverlay=fbtft,spi0-0,ili9486,width=320,height=480,regwidth=16,reset_pin=25,dc_pin=24,rotate=270
```

If you want to use touch, one of the following two lines might work (this might also need the `dtparam=i2c_arm=on` parameter set):

```ini
dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150
dtoverlay=ads7846,cs=1,penirq=25,speed=2000000, swapxy=0, pmax=255, xohms=60, xmin=200, xmax=3900, ymin=200, ymax=3900
```

However, support for this seems to be very flaky, often doesn't work at all, and might conflict with `fbtft` (i.e. you have either touch or display, not both).

</details>