5" Waveshare LCD raspberry pi

created by Łukasz Jakóbiec date: 08/08/2015

Łukasz Jakóbiec 08/08/2015 5" Waveshare LCD raspberry pi

If you would like to run Waveshare LCD without their special image try this - I've got mine to work on vanilla raspbian with dtoverlay and no special hacks needed.

As I was tring to setup this LCD I'v come across all the information that was intended for pre-dtoverlay world. As this is something that is going to stay I wanted to go "the right way" on this.

LCD Display

First of all, to get LCD displaying image - despite being HDMI connected display - you need to edit config.txt in /boot directory. Type nano /boot/config.txt

Add/change lines to look like this:

# uncomment to force a specific HDMI mode (this will force VGA) max_usb_current=1
hdmi_cvt 800 480 60 6 0 0 0

and save (press Ctrl+X, press Y) and reboot. You should have visible console now. Starting X will also display correct image but the touch screen support is missing. To add that you will need to edit config.txt once more.

Touchscreen TSC2046

Type nano /boot/config.txt and at the end of file append this lines:


save & exit. This part will take care or kernel drivers/modules. Now we need to tell a little bit about calibration and input biding for GUI. To do this type:

mkdir /etc/X11/xorg.conf.d
nano /etc/X11/xorg.conf.d/99-calibration.conf

then pase this code to nano:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "130 3989 364 3823"

save and reboot. This will enable SPI pins and load ASD7846 module that is used to drive TSC2046 chip found in this display. Now if your board boots to GUI you should have working display and touch screen if it boots to console login and type startx check if touching the screen moves the cursor.

If you would like to tweak how the LCD is calibrated check notoro github https://github.com/notro/fbtft/wiki/Touchpanel and kernel page for ADS7846 dtoverlay options https://www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt