3.5 inch Touch Screen TFT LCD Designed for Raspberry Pi
3. Enable SPI if needed
4. FBTFT drivers as loadable modules
5. Test
6. Perminantly add Driver
7. Additional settings
and
Insert before "rootwait"
8. Re-enable SPI
9. Touch Screen
10. Edit /etc/modules
11. Touchscreen calibration
Create a new touch screen calibration config file for X
12. Recalibrate
If you need to recalibrate.
Before to start it, you have to delete (if exist) /usr/share/X11/xorg.conf.d/99-calibration.conf
13. Force the screen to stay on
Add the following lines to the [SeatDefaults] section:
More info
New way!
1.) Get dtc compiler with overlay support:
2.) Clone repo onto your pi
1. Expand the filesystem
sudo raspi-config
2. Change fb0 to fb1
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
3. Enable SPI if needed
# remove or comment out the spi blacklist line
sudo nano /etc/modprobe.d/raspi-blacklist.conf
4. FBTFT drivers as loadable modules
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
sudo reboot
5. Test
sudo modprobe flexfb width=480 height=320 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
sudo modprobe fbtft_device debug=3 rotate=0 name=flexfb speed=16000000 gpios=reset:25,dc:24
6. Perminantly add Driver
sudo nano /etc/modules
#Add to file /etc/modules
flexfb width=480 height=320 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
fbtft_device debug=3 rotate=0 name=flexfb speed=16000000 gpios=reset:25,dc:24
7. Additional settings
sudo nano /boot/config.txt
#config.txt
gpu_mem=128
and
sudo nano /boot/cmdline.txt
Insert before "rootwait"
#cmdline.txt
fbcon=map:1 fbcon=font:ProFont6x11
8. Re-enable SPI
sudo raspi-config
9. Touch Screen
sudo apt-get -y install xinput evtest libts-bin
10. Edit /etc/modules
sudo nano /etc/modules
# Touchscreen
ads7846_device model=7846 cs=1 gpio_pendown=17 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900
11. Touchscreen calibration
wget http://adafruit-download.s3.amazonaws.com/xinput-calibrator_0.7.5-1_armhf.deb
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb
Create a new touch screen calibration config file for X
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3930 89 141 3920"
Option "SwapAxes" "0"
EndSection
sudo reboot
12. Recalibrate
If you need to recalibrate.
Before to start it, you have to delete (if exist) /usr/share/X11/xorg.conf.d/99-calibration.conf
DISPLAY=:0.0 xinput_calibrator
13. Force the screen to stay on
sudo nano /etc/lightdm/lightdm.conf
Add the following lines to the [SeatDefaults] section:
#don't sleep the screen
xserver-command=X -s 0 dpms
More info
New way!
1.) Get dtc compiler with overlay support:
wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
sudo ./dtc.sh
2.) Clone repo onto your pi
git clone https://github.com/swkim01/waveshare-dtoverlays.git
3.) According to your LCD's type, copy the overlay file waveshare32b-overlay.dtb or waveshare35b-overlay.dtb to
/boot/overlays
as rootIn case of waveshare 3.2" LCD
sudo cp waveshare-dtoverlays/waveshare32b-overlay.dtb /boot/overlays/
or if linux 4.4 kernel or newer,
sudo cp waveshare-dtoverlays/waveshare32b-overlay.dtb /boot/overlays/waveshare32b.dtbo
In case of waveshare 3.5/4" LCD
sudo cp waveshare-dtoverlays/waveshare35a-overlay.dtb /boot/overlays/
or if linux 4.4 kernel or newer,
sudo cp waveshare-dtoverlays/waveshare35a-overlay.dtb /boot/overlays/waveshare35a.dtbo
4.) Specify this overlay file in your
/boot/config.txt
dtoverlay=waveshare32b
ordtoverlay=waveshare35a
You can configure some parameters of the lcd module like this:
dtoverlay=waveshare32b:rotate=270
dtoverlay=waveshare35a:rotate=90,swapxy=1
5.) reboot your raspberry pi