I've bought 4inch IPS LCD from WaveShare but cannot get it run on newest Raspberry PI 2. The original DVD comes with image which isn't compatible with RPI 2.
I've followed instructions from http://www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi/#content. But use flexfb device instead of waveshare32b. You may keep the configuration of touch device, but have to calibrate it or rotate screen to keep it as is.
Add modules in /etc/modules as below:
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
Changing screen rotation is a bit tricky but possible. You have to modify value of register 0x36 at the end of init string (value 0x28 just after 0x36). In the example above there is 0x28, as well as rotate=0 below. This is for horizontal screen with power socket on upper side, touch inverted. You can try these combinations:
Above values are found by testing, may not be the best settings but works :)
This is my /boot/cmdline.txt file:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=flexfb fbtft_device.gpios=dc:24,reset:25 fbtft_device.bgr=1 fbtft_device.speed=16000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0
Note: The Noobs distribution of Raspbian installs the root filesystem to logical partition p6 rather than the second primary partition p2. The above change to /boot/cmdline.txt assumes the filesystem is on p2. If you are using Noobs and you get a kernel panic following reboot after this change, log in using Recovery Mode and edit the line above changing root=/dev/mmcblk0p2 to root=/dev/mmcblk0p6.
and my /etc/modules entry for touch device:
ads7846_device model=7846 cs=1 gpio_pendown=17 speed=1000000 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
Full thread can be found there https://github.com/notro/fbtft/issues/215
The manuel you used is not for a waveshare spotPear touchscreen, only a waveshare one. Try this one: http://diyhacking.com/raspberry-pi-touchscreen-lcd-tutorial/
I found a step-by-step forum that finally helped me... I have the 4inch Waveshare and a RPi B+ with Raspbian originally downloaded from the Raspberry page.
Update firmware with:
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
Enable SPI in raspi-config.
sudo nano /etc/modules
flexfb nobacklight 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 width=480 height=320
fbtft_device name=flexfb speed=16000000 gpios=reset:25,dc:24
sudo nano /boot/cmdline.txt
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
sudo nano /boot/config.txt
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf (Copy-paste)
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3900 240 3900 240"
I have the 4" Spotpear IPS model and a RPi zero. Now with a current Raspian version (~2016), it is not necessary to use the notro firmware anymore and you can simply use the overlay provided here. Make sure you copy the overlay to /boot/overlays/waveshare35a-overlay.dtb (Kernel < 4.4) or /boot/overlays/waveshare35a.dtbo (Kernel >= 4.4). Add an overlay entry to /boot/config.txt:
If you have problems with screwed-up colors, try lowering the SPI speed. I had funky colors with 16MHz, but up to 14MHz worked ok:
This should already give you /dev/fb1 for the LCD. You may then want to adjust your resolution to 480x320 in config.txt, using:
If you are using fbcp to copy fb1 content to fb1, you may also want to adjust the resolution of the HDMI display to 640x400 (tables here) using:
This gives you an almost-filled screen. There is some blank space horizontally, but except that, it looks fine. It may sound intriguing to use a hdmi_cvt modeline to set the resolution to the proper 480x320, but found this to NOT work very well:
hdmi_cvt=480 320 60 1 0 0 0
To make the console readable, edit /boot/cmdline.txt and add: